Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.3.0
-
None
Description
Scenario:
- a QWidget with the Qt::PopUp WindowFlag is used as a popup across the application
- the popup works fine if it's children are regular QWidgets
- a QQuickWidget is added as a direct child to the custom QWidget-popup
- a Qml file with a single TextInput is loaded into the QQuickWidget
- the popup is displayed to the user using QWidget::show
Expected Behaviour:
- the popup should show
- the QQuickWidget should load and render the Qml file
- the user should be able to enter text inside the TextInput shown in the QQuickWidget
Actual Behaviour:
- the popup shows
- the QQuickWidget loads and renders the Qml file
- the user cannot enter any text inside the TextInput as the keyboard focus is never set inside the QQuickWidget
- the situation remains unchanged even after clicking into the TextInput
- the situation remains unchanged if forceActiveInput is used on the TextInput
- mouse interaction is fully working, but no keyboard input
Questions you might ask:
- why are you using QQuickWidget instead of QQuickWindow?
because otherwise we couldn't wrap it into our custom popup
- why use a custom QWidget popup and not directly use the QQuickWidget as popup?
the custom QWidget popup uses Qt::WA_TranslucentBackground and some extra painting to achieve a "balloon" style popup look which is otherwise not available
Additional Information:
Further analysis (using QT_LOGGING_RULES=qt.quick.focus=true) shows that the activeInputItem is never set or changed, even if explicitly ordered to do so by using forceActiveInput in the TextInput or by clicking on the TextInput.
[qt.quick.focus] QQuickDeliveryAgent(root=QQuickRootItem) focus QQuickRootItem(0x..., parent=0x0, geometry=0,0 1110x740) in scope QQuickItem(nullptr)
[qt.quick.focus] activeFocusItem remains QQuickItem(nullptr) in QQuickDeliveryAgent(root=QQuickRootItem)
[qt.quick.focus] QQuickDeliveryAgent(root=QQuickRootItem) focus QQuickRootItem(0x..., parent=0x0, geometry=0,0 1110x740) in scope QQuickItem(nullptr)
[qt.quick.focus] activeFocusItem QQuickItem(nullptr) -> TextInput_QMLTYPE_43(0x..., parent=0x.., geometry=158,31 868x44) in QQuickDeliveryAgent(root=QQuickRootItem)