mirror of https://code.videolan.org/videolan/vlc
qt/interface_window_handler: Make the visualFocus condition generic
Previously this condition was only working for QQuickControl(s). But we might want it to work with a non Control component, like a TextInput. In that case we declare a 'visualFocus' property manually and bind it to a parent Control 'visualFocus' property.
This commit is contained in:
parent
29b742d3a7
commit
7cb89f2ba4
|
@ -365,10 +365,9 @@ bool InterfaceWindowHandler::applyKeyEvent(QKeyEvent * event) const
|
|||
|
||||
QQuickItem * item = p_intf->p_compositor->activeFocusItem();
|
||||
|
||||
// NOTE: When this item is a control and has visual focus we let it handle the key.
|
||||
if (item && item->inherits("QQuickControl")
|
||||
&&
|
||||
QQmlProperty(item, "visualFocus", qmlContext(item)).read().toBool())
|
||||
// NOTE: When the item has visual focus we let it handle the key. When the item does not
|
||||
// inherit from QQuickControl we have to declare the 'visualFocus' property ourselves.
|
||||
if (item && QQmlProperty(item, "visualFocus", qmlContext(item)).read().toBool())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue