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

Shortcut doesn't work in QQuickWidget

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 5.9.4, 5.10.1
    • 5.9.2, 5.10.0 Beta 4
    • Quick: Widget
    • None
    • a79feeee451bcf28673292555795677a789e8513

      when a QML scene is embedded in a QQuickWidget and the Shortcut {} element is used, the shortcut won't actually work, because in qquickshortcut.cpp, the matcher does:

      static bool qQuickShortcutContextMatcher(QObject *obj, Qt::ShortcutContext context)
      {
      switch (context) {
      case Qt::ApplicationShortcut:
      return true;
      case Qt::WindowShortcut:
      while (obj && !obj->isWindowType()) {
      obj = obj->parent();
      if (QQuickItem *item = qobject_cast<QQuickItem *>(obj))
      obj = item->window();
      }
      return obj && obj == QGuiApplication::focusWindow();
      default:
      return false;
      }
      }

       

      so it will never match as the internal QWindow of a QQuickWidget will never be the qguiapplication's focusWindow

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

            tvete Paul Olav Tvete
            notmart Marco Martin
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes