c++ - QtQuick key press event propagation -


i have qt gui application. main window contains qtquick component placed on using window container:

qquickview * view = new qquickview (); qwidget * container = qwidget::createwindowcontainer (view, this); 

i'd handle key press events under whole window. faced problem can't handle key events when focus acquired qtquick component if i've set window parent it.

the documentation such behaviour expected:

qwidget *qwidget::createwindowcontainer(qwindow *window, qwidget *parent = > q_nullptr, qt::windowflags flags = qt::windowflags())
...
window container has number of known limitations:
...
focus handling; possible let window container instance have focus policy , delegate focus window via call qwindow::requestactivate(). however, returning normal focus chain qwindow instance qwindow instance implementation itself. instance, when entering qt quick based window tab focus, quite further tab presses cycle inside qml application. also, whether qwindow::requestactivate() gives window focus, platform dependent.

my question is: there way handle key press event under whole window if focus acquired qtquick component?

minimal , complete example available @ gitlab.

one possible (but ugly) solution is:

  1. handle key press event in qml;
  2. notify c++ code qml signal;
  3. in c++ code generate key press event;
  4. handle native event , regenerated event in common event filter.

example available @ gitlab.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -