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

Hover is not working after opening external link on macOS

    XMLWordPrintable

Details

    • macOS

    Description

      I found a bug report on StackOverflow and I have the same thing (https://stackoverflow.com/questions/49324832/qt-hover-is-not-working-after-opening-external-link-on-macos).
       
      This reproduces for QML and QWidget's, but my example is in QML.

      So here is an example:

      import QtQuick 2.12
      import QtQuick.Window 2.12
      import QtQuick.Controls 2.12
      
      ApplicationWindow {
          id: rootWindow
      
          visible: true
          width: 640
          height: 480
          color: "gold"
      
          ListView {
              width: parent.width
              height: parent.height / 2 * 3
              model: 5
              spacing: 1
              delegate: Rectangle {
                  width: parent.width
                  height: 50
                  color: ma.containsMouse ? "mediumvioletred" : "mintcream"
                  border.color: "black"
                  border.width: 1
      
                  Text {
                      anchors.centerIn: parent
                      text: "Click on me to open google.com"
                      font.bold: true
                  }
      
                  MouseArea {
                      id: ma
                      anchors.fill: parent
                      onClicked: Qt.openUrlExternally("https://www.google.com/");
                      hoverEnabled: true
                  }
              }
          }
      
          Text {
              width: parent.width
              height: 200
              anchors.bottom: parent.bottom
              color: "black"
              text: "1. Click on any list element (note color when hovered)\n2. Re-gain focus by click outside of the list (gold color area)\n3. Hover list element";
              font.bold: true
              horizontalAlignment: Qt.AlignHCenter
              verticalAlignment: Qt.AlignVCenter
          }
      }
      

      Do the following:

      1. Click on the list element to open external link in the browser.
      2. Close browser window so you can see this example app's window and click outside of a list (gold area).
      3. Immediately after this, try to hover list element. Result - hover stops working for some time. If you move mouse pointer outside of the main window and then return it back - hover starts working.

      If you switch back to example app by using e.g. Dock - bug is not happening. It happens only in case you bring app's window to foreground by just clicking inside of its area.

      This is NOT a macOS behavior because it can't be reproduced with a non-Qt application.

      Attachments

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

        Activity

          People

            vhilshei Volker Hilsheimer
            alervd Alexander Dyagilev
            Votes:
            2 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes