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

QML does not handle keys and focus when open widgets popup menu

XMLWordPrintable

    • macOS

      1. create MainWindow with menu bar on the top with any actions (aka "open", "close" or any)
      2. add QQuickView to the central widget of MainWindow using
      QWidget::createWindowContainer(quickview);
      3. In qml file create Item with keyboard focus, like this:
      onFocusChanged: console.log("focus changed to ", focus);
      onActiveFocusChanged: console.log("active focus changed", activeFocus);

      Keys.onPressed: console.log("pressed: ", event.key);
      Keys.onReleased: console.log("released: ", event.key);
      4. Run application, press any button and while this button is pressed - open menu of mainWindow. While menu is opened - release pressed button.
      5. No signals "active focus changed" or "key released" emitted.

      Other description: using event(QEvent*event) method of QQuickiView. In this case wi will not receive FocusOutEvent or KeyReleaseEvent when menu is opened and button released.

      Reason:
      QApplication::OpenPopup send FocusOut event only to focus widget, but the QQuickView is a focusWindow;

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

            srutledg Shawn Rutledge
            ctin Konstantin
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes