From 722fb8511c937685e1449029378cc2054870ea8d Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 4 Feb 2019 18:22:22 +0100 Subject: [PATCH] avoiding a Qt assertion, by doing the check before --- src/controls/QskPopup.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/controls/QskPopup.cpp b/src/controls/QskPopup.cpp index 7b5cadf6..a1209fdd 100644 --- a/src/controls/QskPopup.cpp +++ b/src/controls/QskPopup.cpp @@ -12,6 +12,7 @@ QSK_QT_PRIVATE_BEGIN #include +#include QSK_QT_PRIVATE_END QSK_SUBCONTROL( QskPopup, Overlay ) @@ -33,9 +34,15 @@ static void qskSetFocus( QQuickItem* item, bool on ) auto dw = QQuickWindowPrivate::get( item->window() ); if ( on ) + { dw->setFocusInScope( scope, item, Qt::PopupFocusReason ); + } else - dw->clearFocusInScope( scope, item, Qt::PopupFocusReason ); + { + // to avoid an assertion we have to check if we have the subFocus + if ( QQuickItemPrivate::get( scope )->subFocusItem == item ) + dw->clearFocusInScope( scope, item, Qt::PopupFocusReason ); + } } }