diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2016-05-10 12:44:15 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-05-11 20:34:14 +0000 |
commit | eb6e122c68333382309843ad96e7d04d2c5a3595 (patch) | |
tree | e0bcabf84ae8822382d17b802445f5b456580ad5 /src/quicktemplates2 | |
parent | 25ef915acd941f0c8db3f7102a2deeaab17e6d14 (diff) |
Popup: restore focus to contentItem of ApplicationWindow when closing
In Controls2, Popup and normal content are in same window, then we
should maintain the focus restore work.
Task-number: QTBUG-53275
Change-Id: I57f5aaf3febf1b7d2071c1734d8561932f95c699
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r-- | src/quicktemplates2/qquickapplicationwindow.cpp | 2 | ||||
-rw-r--r-- | src/quicktemplates2/qquickpopup.cpp | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp index 401313d8..940e5eeb 100644 --- a/src/quicktemplates2/qquickapplicationwindow.cpp +++ b/src/quicktemplates2/qquickapplicationwindow.cpp @@ -424,6 +424,8 @@ QQuickItem *QQuickApplicationWindow::contentItem() const QQuickApplicationWindowPrivate *d = const_cast<QQuickApplicationWindowPrivate *>(d_func()); if (!d->contentItem) { d->contentItem = new QQuickItem(QQuickWindow::contentItem()); + d->contentItem->setFlag(QQuickItem::ItemIsFocusScope); + d->contentItem->setFocus(true); d->relayout(); } return d->contentItem; diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index 0f2e8378..baa4bd8a 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -232,6 +232,12 @@ void QQuickPopupPrivate::finalizeExitTransition(bool hide) popupItem->setVisible(false); } + QQuickApplicationWindow *applicationWindow = qobject_cast<QQuickApplicationWindow*>(window); + if (applicationWindow) + applicationWindow->contentItem()->setFocus(true); + else if (window) + window->contentItem()->setFocus(true); + visible = false; emit q->visibleChanged(); emit q->closed(); |