Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.7.0 Beta
-
None
-
Android 4.4
-
9a1c9459a61cdd3ddb1bd0608a2caa9bae632e58
Description
Consider simple test program:
Page { Drawer { height: parent.height width: 300 onActiveFocusChanged: console.log("drawer", activeFocus) ComboBox { model: [ "111", "222" ] onActiveFocusChanged: console.log("combobox", activeFocus) } } }
After opening drawer It gain active focus. After click on combobox, it gain active focus true. But after click on drawer, both drawer and combobox lose active focus.
One more example to illustrate problem.
I tried to fix some not handling of the back key on mobile devices in https://codereview.qt-project.org/159398 And it works fine for popups, drawers and comboboxes. But, if there is a combobox in a drawer, it doesn't work after I click on combobox: I can close combobox by using Back key, but next time I press this key, it doesn't pass to the drawer, as expected, but proceed to the drawer's parent, and close application, if I don't handle it.
To reproduce, run next program on mobile device, click on "push", open drawer, click on combobox. Press back - combobox should close. Press back again and page with drawer should disappear, but overlay still here (another bug?), see attached screenshot.
import QtQuick 2.6 import QtQuick.Controls 2.0 ApplicationWindow { visible: true width: 640 height: 480 Component { id: second Page { Drawer { height: parent.height width: 300 onActiveFocusChanged: console.log("drawer", activeFocus) ComboBox { model: [ "111", "222" ] onActiveFocusChanged: console.log("combobox", activeFocus) } } } } FocusScope { anchors.fill: parent focus: true Keys.onBackPressed: { console.log("back") stackView.pop() } Rectangle { id: first color: "orange" } StackView { id: stackView anchors.fill: parent anchors.bottomMargin: 50 initialItem: first } Button { anchors.bottom: parent.bottom text: "push" onClicked: stackView.push(second) } } }
Attachments
For Gerrit Dashboard: QTBUG-53451 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
159428,8 | Don't restore focus to contentItem when a focusless popup was closed | 5.7 | qt/qtquickcontrols2 | Status: MERGED | +2 | 0 |