yes, this is an issue, keyboard actions on widgets that have the active focus but not the visual focus should be inhibited (and sent to the vout in the case of the player).
After investigating with @chub, when clicking a Control it gets focused by default and the spacebar behavior is hard-coded in its implementation. As a result, the following is never called in Player.qml: mainInterface.sendHotkey.
At the moment, we are not exactly sure how to prevent the Control to do that without breaking keyboard navigation.
You can add this to InterfaceWindowHandler::eventFilter
caseQEvent::KeyRelease:caseQEvent::KeyPress:{constautokeyEvent=static_cast<QKeyEvent*>(event);// Navigation keys should not be filtered// otherwise navigation will not work, or// we need to define a global navigation mode// to enter explicitlyswitch(keyEvent->key()){caseQt::Key_Left:caseQt::Key_Right:caseQt::Key_Up:caseQt::Key_Down:caseQt::Key_Tab:caseQt::Key_Backtab:returnfalse;}constautofocusObject=m_window->focusObject();constboolisControl=focusObject->inherits("QQuickControl");if(isControl){constQVarianthasVisualFocus=QQmlProperty(focusObject,"visualFocus",qmlContext(focusObject)).read();assert(hasVisualFocus.canConvert<bool>());if(hasVisualFocus.value<bool>()){// Control has visual focus, let it handle the keyreturnfalse;}}else{// We don't want to break key handling// in other items.returnfalse;}if(event->type()==QEvent::KeyPress)m_mainInterface->sendHotkey(static_cast<Qt::Key>(keyEvent->key()),keyEvent->modifiers());keyEvent->accept();returntrue;}
the idea might work, I don't know though if the filtering should be done globally like you propose or at the QML component level
const auto focusObject = m_window->focusObject();
I'm not sure this works with every compositor, I think it's best to use activeFocusItem, this of course need to be forwarded from every compositor
switch (keyEvent->key()) { case Qt::Key_Left: case Qt::Key_Right: case Qt::Key_Up: case Qt::Key_Down: case Qt::Key_Tab: case Qt::Key_Backtab: return false; }
we probably need a better policy than that, assume this scenario, if you're in the player and you press up the volume will goes up, but the visual focus is also be gained.
How do I access the QQuickWindow from InterfaceWindowHandler
you don't
As I said in my previous message, and told you privately, this of course need to be forwarded from every compositor
in other words, every Compositor has a QQuickWindow in its implementation, this need to be exposed or provide an activeFocusItem function that will forward the call to the actual QQuickWindow