From 93dc6f76f7f532050dcd3d50eba2b548005ba802 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 26 Oct 2020 17:59:19 +0100 Subject: [PATCH] Qt6 incompatibilities fixed --- src/controls/QskControl.cpp | 4 ++-- src/controls/QskControl.h | 2 +- src/controls/QskQuickItem.cpp | 23 +++++++++++++++++++++-- src/controls/QskQuickItem.h | 8 +++++++- src/controls/QskQuickItemPrivate.cpp | 2 +- 5 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/controls/QskControl.cpp b/src/controls/QskControl.cpp index 9ee7aacd..3a70fd6a 100644 --- a/src/controls/QskControl.cpp +++ b/src/controls/QskControl.cpp @@ -886,7 +886,7 @@ void QskControl::itemChange( QQuickItem::ItemChange change, Inherited::itemChange( change, value ); } -void QskControl::geometryChanged( +void QskControl::geometryChange( const QRectF& newGeometry, const QRectF& oldGeometry ) { if ( d_func()->autoLayoutChildren ) @@ -895,7 +895,7 @@ void QskControl::geometryChanged( polish(); } - Inherited::geometryChanged( newGeometry, oldGeometry ); + Inherited::geometryChange( newGeometry, oldGeometry ); } void QskControl::windowDeactivateEvent() diff --git a/src/controls/QskControl.h b/src/controls/QskControl.h index 5bfa2ef2..92f9c518 100644 --- a/src/controls/QskControl.h +++ b/src/controls/QskControl.h @@ -196,7 +196,7 @@ class QSK_EXPORT QskControl : public QskQuickItem, public QskSkinnable virtual bool gestureFilter( QQuickItem*, QEvent* ); void itemChange( ItemChange, const ItemChangeData& ) override; - void geometryChanged( const QRectF&, const QRectF& ) override; + void geometryChange( const QRectF&, const QRectF& ) override; void windowDeactivateEvent() override; void initSizePolicy( QskSizePolicy::Policy, QskSizePolicy::Policy ); diff --git a/src/controls/QskQuickItem.cpp b/src/controls/QskQuickItem.cpp index efd9eea6..be1ca64f 100644 --- a/src/controls/QskQuickItem.cpp +++ b/src/controls/QskQuickItem.cpp @@ -290,11 +290,16 @@ void QskQuickItem::setGeometry( qreal x, qreal y, qreal width, qreal height ) d->dirty( QQuickItemPrivate::Size ); /* - Unfortunately geometryChanged is protected and we can't implement + Unfortunately geometryChange(d) is protected and we can't implement this code as qskSetItemGeometry - further hacking required: TODO ... */ - geometryChanged( QRectF( d->x, d->y, d->width, d->height ), oldRect ); + const QRectF newRect( d->x, d->y, d->width, d->height ); +#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) + geometryChange( newRect, oldRect ); +#else + geometryChanged( newRect, oldRect ); +#endif } } @@ -787,10 +792,24 @@ void QskQuickItem::itemChange( QQuickItem::ItemChange change, Inherited::itemChange( change, value ); } +#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) + void QskQuickItem::geometryChanged( const QRectF& newGeometry, const QRectF& oldGeometry ) { + geometryChange( newGeometry, oldGeometry ); +} + +#endif + +void QskQuickItem::geometryChange( + const QRectF& newGeometry, const QRectF& oldGeometry ) +{ +#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) Inherited::geometryChanged( newGeometry, oldGeometry ); +#else + Inherited::geometryChange( newGeometry, oldGeometry ); +#endif Q_D( const QskQuickItem ); if ( !d->polishScheduled && d->polishOnResize ) diff --git a/src/controls/QskQuickItem.h b/src/controls/QskQuickItem.h index 18af8457..5ac88e4d 100644 --- a/src/controls/QskQuickItem.h +++ b/src/controls/QskQuickItem.h @@ -118,7 +118,13 @@ class QSK_EXPORT QskQuickItem : public QQuickItem virtual void windowChangeEvent( QskWindowChangeEvent* ); void itemChange( ItemChange, const ItemChangeData& ) override; - void geometryChanged( const QRectF&, const QRectF& ) override; +#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) + void geometryChange( const QRectF&, const QRectF& ) override; +#else + // using geometryChange also for Qt5 + void geometryChanged( const QRectF&, const QRectF& ) override final; + virtual void geometryChange( const QRectF&, const QRectF& ); +#endif virtual void aboutToShow(); // called in updatePolish diff --git a/src/controls/QskQuickItemPrivate.cpp b/src/controls/QskQuickItemPrivate.cpp index cedebc49..d970d3d9 100644 --- a/src/controls/QskQuickItemPrivate.cpp +++ b/src/controls/QskQuickItemPrivate.cpp @@ -152,7 +152,7 @@ void QskQuickItemPrivate::setImplicitSize( qreal w, qreal h, bool doNotify ) const QRectF newRect( x, y, width, height ); Q_Q( QskQuickItem ); - q->geometryChanged( newRect, oldRect ); + q->geometryChange( newRect, oldRect ); } }