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

QQC2 Dialog inside QQuickWidget has broken keyboard navigation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 6.10
    • None

    Description

      Consider the following code:

       

      import QtQuick
      import QtQuick.Layouts
      import QtQuick.Controls as QQC2
      
      Item {
          id: root
      
          width: 800
          height: 600
      
          QQC2.Dialog {
              id: addCommandDialog
      
              visible: true
              standardButtons: QQC2.Dialog.Apply | QQC2.Dialog.Cancel
              ColumnLayout {
                  QQC2.TextField {
                      id: cmdField
                  }
                  QQC2.TextField {
                      id: nameField
                  }
              }
          }
      } 
      #include <QApplication>
      #include <QQuickWidget>
      #include <QMainWindow>
      #include <QVBoxLayout>
      #include <QPushButton>
      
      int main(int argc, char**argv)
      {
          QApplication app(argc, argv);
      
          auto window = new QMainWindow;
          window->setFixedSize(1000, 800);
          auto qw = new QQuickWidget(QUrl("qrc:/main.qml"), window);
          window->layout()->addWidget(qw);
          window->layout()->addWidget(new QPushButton("Hello", window));
          window->show();
      
          return app.exec();
      }

      Full project at https://invent.kde.org/nicolasfella/dialog-qquickwidget-test

       

      Now focus the first text field. Pressing tab will focus the second text field, as expected. Pressing tab again should focus one of the dialog footer buttons, but instead focusses the QPushButton outside of the QQuickWidget. This is unexpected and makes it impossible to keyboard-nagivate the dialog.

      When running the same QML code outside of a QQuickWidget the dialog buttons are focussed as expected. 

      Attachments

        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
            nicolasfella Nicolas Fella
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes