Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-101573

Popup is not closed when MouseArea on ToolTip is pressed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.5, 6.4
    • Quick: Controls 2
    • None
    • All
    • 90891916a4 (qt/qtdeclarative/dev)

    Description

      MouseAreas on top of ToolTips on top of another MouseArea is preventing unrelated Popups from closing when they should be. Here's a walk through of the issue via minimum reproducible example:

      qmlonline.kde.org link:
      https://tinyurl.com/yd9d2q78

      import QtQuick 2.15
      import QtQuick.Window 2.15
      import QtQuick.Controls 2.12
      import QtQuick.Layouts 1.15
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Button {
              id: button
              text: "First, click me"
              onClicked: {
                  popup.open()
                  tooltip.open()
              }
              
              Popup {
                  id: popup
                  x: parent.width
                  y: parent.height
                  closePolicy: Popup.CloseOnPressOutside
                  background: Rectangle {
                      color: "steelblue"
                  }
                  contentItem: Text {
                      text: "I am a popup!"
                  }
              }
          }
      
          Text {
              x: 10
              y: 100
              text: "Now Hover me"
              MouseArea {
                  // If this MouseArea is removed, then everything works??
                  anchors.fill: parent
                  hoverEnabled: true
              }
              ToolTip {
                  id: tooltip
                  x: 0
                  y: 0
                  closePolicy: Popup.NoAutoClose
                  background: Rectangle {
                      color: "grey"
                  }
                  contentItem: Text {
                      text: "I am a tooltip, click me"
                      MouseArea {
                          id: popupMouseArea
                          anchors.fill: parent
                          onClicked: {
                              popup2.open()
                          }
                      }
                  }
              }
          }
      
          Popup {
              id: popup2
              y: 75
              background: Rectangle {
                  color: "peachpuff"
              }
              contentItem: Text {
                  text: "Why didn't the original popup close because of 'PressOnOutside'?"
              }
          }
      }
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              jhuels20 Joshua Huels
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes