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

QQuickWidget: shortcut override events gone missing

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.9.1
    • 5.9.0 Beta 4
    • Quick: Widget
    • None
    • 44a5b008f7a6dce065f5997503e403609ee62859

    Description

      QQuickTextInput handles Key_Space and Key_Backspace etc. as shortcut overrides. Since https://codereview.qt-project.org/#/c/186409/ it no longer receives shortcut override events at all.

      #include <QtWidgets>
      #include <QtQuickWidgets>
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          QMainWindow window;
      
          const QList<Qt::Key> keys = {Qt::Key_Space, Qt::Key_Backspace};
          for (Qt::Key key : keys) {
              QShortcut *shortcut = new QShortcut(key, &window);
              QObject::connect(shortcut, &QShortcut::activated, [=]() {
                  qDebug() << "QShortcut::activated:" << shortcut->key();
              });
          }
      
          QQuickWidget widget;
          QQmlComponent component(widget.engine());
          component.setData("import QtQuick.Controls 2.0; TextField { focus: true; text: 'Press (back)space...' }", QUrl());
          widget.setContent(QUrl(), &component, component.create());
      
          window.setCentralWidget(&widget);
          window.show();
          return app.exec();
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              lagocs Laszlo Agocs
              jpnurmi J-P Nurmi
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes