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

QPushButton triggers a Qt.labs.platform Menu within QQuickWidget, resulting in focus issues.

    XMLWordPrintable

Details

    • macOS

    Description

      In a Qt widget-based application, there is a QPushButton that, when pressed, shows a Qt.labs.platform Menu within a QQuickWidget through signals and slots. After clicking any area to close the Menu, the QMainWindow still retains focus, meaning the QPushButton will trigger the Menu again just by moving the mouse over it, without needing to click again. Even using clearFocus, the issue persists. An additional click on the QMainWindow is required to restore normal behavior.

       

      The issue does not occur when using the clicked signal, but due to my business requirements, the Menu must be triggered from the pressed signal.

      test.zip

      After further investigation, I found that the issue was caused by another widget in my code that was calling winId. When I commented out the relevant code for obtaining winId, the issue was resolved. This makes me quite puzzled, as this is a minimal example (in the code, the widget named SideBar was obtaining the winId).

      Attachments

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

        Activity

          People

            tvete Paul Olav Tvete
            stingko Sting ko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes