avoiding a Qt assertion, by doing the check before
This commit is contained in:
parent
724c1e4a66
commit
722fb8511c
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
QSK_QT_PRIVATE_BEGIN
|
QSK_QT_PRIVATE_BEGIN
|
||||||
#include <private/qquickwindow_p.h>
|
#include <private/qquickwindow_p.h>
|
||||||
|
#include <private/qquickitem_p.h>
|
||||||
QSK_QT_PRIVATE_END
|
QSK_QT_PRIVATE_END
|
||||||
|
|
||||||
QSK_SUBCONTROL( QskPopup, Overlay )
|
QSK_SUBCONTROL( QskPopup, Overlay )
|
||||||
@ -33,11 +34,17 @@ static void qskSetFocus( QQuickItem* item, bool on )
|
|||||||
auto dw = QQuickWindowPrivate::get( item->window() );
|
auto dw = QQuickWindowPrivate::get( item->window() );
|
||||||
|
|
||||||
if ( on )
|
if ( on )
|
||||||
|
{
|
||||||
dw->setFocusInScope( scope, item, Qt::PopupFocusReason );
|
dw->setFocusInScope( scope, item, Qt::PopupFocusReason );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// 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 );
|
dw->clearFocusInScope( scope, item, Qt::PopupFocusReason );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static inline void qskSendPopupEvent(
|
static inline void qskSendPopupEvent(
|
||||||
QQuickWindow* window, QskPopup* popup, bool on )
|
QQuickWindow* window, QskPopup* popup, bool on )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user