QML Popup in QWidget Application with focus
-
Here is a screenshot of my app, which (for right now), is mostly a QWidget application. As you can see, two of the three main panes are a
QWidget
controls and the main one is aQQuickWidget
control.The dialog that says "This is the description" is displayed in a
Popup
that springs up from the bottom (the rest of that pane behind the popup is a QMLItem
). However for some reason I'm unable to type into the box.The same QML code works here: https://tinyurl.com/yq9cela5
When I press a key, the control in the second pain is highlighting an item in the list that begins with the letter I've typed, as though it has focus. However the QuickWidget definitely has focus and I can't figure out why I can't type in the box.
There is no special code trapping keystrokes or forcing focus onto the middle pane, and I'm having trouble figuring out why I can't type in the
Popup
.Does anyone have any suggestions?
-
@Wolosocu said in QML Popup in QWidget Application with focus:
Here is a screenshot of my app, which (for right now), is mostly a QWidget application. As you can see, two of the three main panes are a
QWidget
controls and the main one is aQQuickWidget
control.Have you considered converting the entire UI to QML? Sometimes sticking to one UI technology simplifies the problems.
The same QML code works here: https://tinyurl.com/yq9cela5
When I press a key, the control in the second pain is highlighting an item in the list that begins with the letter I've typed, as though it has focus. However the QuickWidget definitely has focus and I can't figure out why I can't type in the box.
Does anyone have any suggestions?
Use the Window.activeFocusItem property to visually track which item has focus.
Window { id: root Rectangle { anchors.fill: root.activeFocusItem color: "transparent" border { color: "red"; width: 1 } } }
Install an event filter on the QApplication to monitor focus and key events.
-
@jeremy_k said in QML Popup in QWidget Application with focus:
Have you considered converting the entire UI to QML? Sometimes sticking to one UI technology simplifies the problems.
I have, and I am. But it's a process. I'm trying to do it in pieces so we can still have regular releases. Eventually though I'd like to have the entire app in QML so that I could also compile it to WebAssembly and have it useable as a website.