Merge branch 'master' into features/drawer
This commit is contained in:
commit
1b8ac518e2
|
@ -103,7 +103,7 @@ void QskMainView::focusInEvent( QFocusEvent* event )
|
||||||
{
|
{
|
||||||
if ( auto focusItem = nextItemInFocusChain( true ) )
|
if ( auto focusItem = nextItemInFocusChain( true ) )
|
||||||
{
|
{
|
||||||
if ( qskIsItemComplete( focusItem )
|
if ( !qskIsItemInDestructor( focusItem )
|
||||||
&& qskIsAncestorOf( this, focusItem ) )
|
&& qskIsAncestorOf( this, focusItem ) )
|
||||||
{
|
{
|
||||||
focusItem->setFocus( true );
|
focusItem->setFocus( true );
|
||||||
|
|
|
@ -539,7 +539,7 @@ void QskPopup::focusInEvent( QFocusEvent* event )
|
||||||
|
|
||||||
if ( auto focusItem = nextItemInFocusChain( true ) )
|
if ( auto focusItem = nextItemInFocusChain( true ) )
|
||||||
{
|
{
|
||||||
if ( qskIsItemComplete( focusItem )
|
if ( !qskIsItemInDestructor( focusItem )
|
||||||
&& qskIsAncestorOf( this, focusItem ) )
|
&& qskIsAncestorOf( this, focusItem ) )
|
||||||
{
|
{
|
||||||
focusItem->setFocus( true );
|
focusItem->setFocus( true );
|
||||||
|
|
|
@ -47,6 +47,21 @@ bool qskIsItemComplete( const QQuickItem* item )
|
||||||
return QQuickItemPrivate::get( item )->componentComplete;
|
return QQuickItemPrivate::get( item )->componentComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool qskIsItemInDestructor( const QQuickItem* item )
|
||||||
|
{
|
||||||
|
auto d = QQuickItemPrivate::get( item );
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK( 6, 5, 0 )
|
||||||
|
return d->inDestructor;
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
QskQuickItem sets componentComplete to false in its destructor,
|
||||||
|
but for other items we will will return the wrong information
|
||||||
|
*/
|
||||||
|
return !d->componentComplete;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool qskIsAncestorOf( const QQuickItem* item, const QQuickItem* child )
|
bool qskIsAncestorOf( const QQuickItem* item, const QQuickItem* child )
|
||||||
{
|
{
|
||||||
if ( item == nullptr || child == nullptr )
|
if ( item == nullptr || child == nullptr )
|
||||||
|
|
|
@ -24,6 +24,7 @@ template< typename T > class QList;
|
||||||
of QQuickItem.
|
of QQuickItem.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
QSK_EXPORT bool qskIsItemInDestructor( const QQuickItem* );
|
||||||
QSK_EXPORT bool qskIsItemComplete( const QQuickItem* );
|
QSK_EXPORT bool qskIsItemComplete( const QQuickItem* );
|
||||||
QSK_EXPORT bool qskIsAncestorOf( const QQuickItem* item, const QQuickItem* child );
|
QSK_EXPORT bool qskIsAncestorOf( const QQuickItem* item, const QQuickItem* child );
|
||||||
QSK_EXPORT bool qskIsTabFence( const QQuickItem* );
|
QSK_EXPORT bool qskIsTabFence( const QQuickItem* );
|
||||||
|
|
|
@ -180,6 +180,11 @@ QskQuickItem::~QskQuickItem()
|
||||||
We set componentComplete to false, so that operations
|
We set componentComplete to false, so that operations
|
||||||
that are triggered by detaching the item from its parent
|
that are triggered by detaching the item from its parent
|
||||||
can be aware of the about-to-delete state.
|
can be aware of the about-to-delete state.
|
||||||
|
|
||||||
|
Note, that since Qt >= 6.5 this information is stored
|
||||||
|
in QQuickItemPrivate::inDestructor.
|
||||||
|
|
||||||
|
s.a: qskIsItemInDestructor
|
||||||
*/
|
*/
|
||||||
d_func()->componentComplete = false;
|
d_func()->componentComplete = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue