From b5fb6d80ad64ad6f7f0c9f40a1d866025a63770e Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 30 Oct 2023 17:08:01 +0100 Subject: [PATCH 1/2] the itemNode is always a QSGTransformNode --- src/controls/QskQuick.cpp | 2 +- src/controls/QskQuick.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/controls/QskQuick.cpp b/src/controls/QskQuick.cpp index 43967d29..6a8f045f 100644 --- a/src/controls/QskQuick.cpp +++ b/src/controls/QskQuick.cpp @@ -371,7 +371,7 @@ QList< QQuickItem* > qskPaintOrderChildItems( const QQuickItem* item ) return QList< QQuickItem* >(); } -const QSGNode* qskItemNode( const QQuickItem* item ) +const QSGTransformNode* qskItemNode( const QQuickItem* item ) { if ( item == nullptr ) return nullptr; diff --git a/src/controls/QskQuick.h b/src/controls/QskQuick.h index 458edf4f..6b2ae2df 100644 --- a/src/controls/QskQuick.h +++ b/src/controls/QskQuick.h @@ -16,6 +16,7 @@ class QskSizePolicy; class QQuickItem; class QSGNode; +class QSGTransformNode; class QRectF; template< typename T > class QList; @@ -67,7 +68,7 @@ QSK_EXPORT QList< QQuickItem* > qskPaintOrderChildItems( const QQuickItem* ); QSK_EXPORT void qskUpdateInputMethod( const QQuickItem*, Qt::InputMethodQueries ); QSK_EXPORT void qskInputMethodSetVisible( const QQuickItem*, bool ); -QSK_EXPORT const QSGNode* qskItemNode( const QQuickItem* ); +QSK_EXPORT const QSGTransformNode* qskItemNode( const QQuickItem* ); QSK_EXPORT const QSGNode* qskPaintNode( const QQuickItem* ); QSK_EXPORT void qskItemUpdateRecursive( QQuickItem* ); From 3b4f1677095af67a063c6c5c595ad176cdee0427 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 30 Oct 2023 17:08:39 +0100 Subject: [PATCH 2/2] always sending ( ot posting ) animator events. Otherwise we might be one updateNode cycle too late --- src/controls/QskHintAnimator.cpp | 48 +++++++++++++++----------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/src/controls/QskHintAnimator.cpp b/src/controls/QskHintAnimator.cpp index d9dc82f0..cec53ccd 100644 --- a/src/controls/QskHintAnimator.cpp +++ b/src/controls/QskHintAnimator.cpp @@ -76,20 +76,28 @@ static inline QVariant qskAligned05( const QVariant& value ) #endif -static inline bool qskCheckReceiverThread( const QObject* receiver ) +static inline void qskSendAnimatorEvent( + const QskAspect aspect, int index, bool on, QObject* receiver ) { - /* - QskInputPanelSkinlet changes the skin state, what leads to - sending events from the wrong thread. Until we have fixed it - let's block sending the event to avoid running into assertions - in QCoreApplication::sendEvent - */ + const auto state = on ? QskAnimatorEvent::Started : QskAnimatorEvent::Terminated; - const QThread* thread = receiver->thread(); - if ( thread == nullptr ) - return true; - - return ( thread == QThread::currentThread() ); + const auto thread = receiver->thread(); + if ( thread && ( thread != QThread::currentThread() ) ) + { + /* + QskInputPanelSkinlet changes the skin state, what leads to + sending events from the wrong thread. We can't use + QCoreApplication::sendEvent then, TODO ... + */ + + auto event = new QskAnimatorEvent( aspect, index, state ); + QCoreApplication::postEvent( receiver, event ); + } + else + { + QskAnimatorEvent event( aspect, index, state ); + QCoreApplication::sendEvent( receiver, &event ); + } } QskHintAnimator::QskHintAnimator() noexcept @@ -338,11 +346,7 @@ void QskHintAnimatorTable::start( QskControl* control, animator->start(); - if ( qskCheckReceiverThread( control ) ) - { - QskAnimatorEvent event( aspect, index, QskAnimatorEvent::Started ); - QCoreApplication::sendEvent( control, &event ); - } + qskSendAnimatorEvent( aspect, index, true, control ); } const QskHintAnimator* QskHintAnimatorTable::animator( QskAspect aspect, int index ) const @@ -390,15 +394,7 @@ bool QskHintAnimatorTable::cleanup() it = animators.erase( it ); if ( control ) - { - if ( qskCheckReceiverThread( control ) ) - { - auto event = new QskAnimatorEvent( - aspect, index, QskAnimatorEvent::Terminated ); - - QCoreApplication::postEvent( control, event ); - } - } + qskSendAnimatorEvent( aspect, index, false, control ); } else {