Qt 6.2 adjustments

This commit is contained in:
Uwe Rathmann 2021-09-21 08:51:01 +02:00
parent c5ebb6c298
commit f9ca36443e
5 changed files with 51 additions and 12 deletions

View File

@ -9,28 +9,36 @@
#include "QskGlobal.h" #include "QskGlobal.h"
#include <qmetaobject.h> #include <qmetaobject.h>
/* #if QT_VERSION < QT_VERSION_CHECK( 5, 8, 0 )
hack to run moc over a namespace, what is not // hack to run moc over a namespace
yet supported with Qt 5.6
*/
#ifdef Q_MOC_RUN #ifdef Q_MOC_RUN
#define QSK_NAMESPACE( name ) struct name #define QSK_NAMESPACE( name ) struct name
#define QSK_ENUM( name ) Q_GADGET Q_ENUM( name ) #define QSK_ENUM( name ) Q_GADGET Q_ENUM( name )
#else
#define QSK_NAMESPACE( name ) namespace name
#define QSK_ENUM( name ) \
inline constexpr const QMetaObject* qt_getEnumMetaObject(name) noexcept { return &staticMetaObject; } \
inline constexpr const char* qt_getEnumName(name) noexcept { return #name; }
#endif
#define QSK_Q_NAMESPACE extern const QMetaObject staticMetaObject;
#else #else
#define QSK_NAMESPACE( name ) namespace name #define QSK_NAMESPACE( name ) namespace name
#define QSK_ENUM( name ) \ #define QSK_ENUM Q_ENUM_NS
inline constexpr const QMetaObject* qt_getEnumMetaObject(name) noexcept { return &staticMetaObject; } \
inline constexpr const char* qt_getEnumName(name) noexcept { return #name; }
#define QSK_Q_NAMESPACE Q_NAMESPACE
#endif #endif
QSK_NAMESPACE( Qsk ) QSK_NAMESPACE( Qsk )
{ {
extern QSK_EXPORT const QMetaObject staticMetaObject; QSK_EXPORT QSK_Q_NAMESPACE
enum Direction enum Direction
{ {
@ -62,5 +70,6 @@ QSK_NAMESPACE( Qsk )
#undef QSK_NAMESPACE #undef QSK_NAMESPACE
#undef QSK_ENUM #undef QSK_ENUM
#undef QSK_Q_NAMESPACE
#endif #endif

View File

@ -256,8 +256,13 @@ void QskQuickItem::setGeometry( qreal x, qreal y, qreal width, qreal height )
Q_D( QQuickItem ); Q_D( QQuickItem );
#if QT_VERSION >= QT_VERSION_CHECK( 6, 2, 0 )
d->heightValidFlag = true;
d->widthValidFlag = true;
#else
d->heightValid = true; d->heightValid = true;
d->widthValid = true; d->widthValid = true;
#endif
const QRectF oldRect( d->x, d->y, d->width, d->height ); const QRectF oldRect( d->x, d->y, d->width, d->height );
@ -541,7 +546,11 @@ void QskQuickItem::applyUpdateFlag( UpdateFlag flag, bool on )
// Update the implicitSize and rebind the size to it. // Update the implicitSize and rebind the size to it.
// Having set the size explicitly gets lost. // Having set the size explicitly gets lost.
#if QT_VERSION >= QT_VERSION_CHECK( 6, 2, 0 )
d->widthValidFlag = d->heightValidFlag = false;
#else
d->widthValid = d->heightValid = false; d->widthValid = d->heightValid = false;
#endif
d->updateImplicitSize( false ); d->updateImplicitSize( false );
} }

View File

@ -38,7 +38,11 @@ QskQuickItemPrivate::QskQuickItemPrivate()
but to make it working: the DeferredLayout flag needs to be disabled. but to make it working: the DeferredLayout flag needs to be disabled.
*/ */
#if QT_VERSION >= QT_VERSION_CHECK( 6, 2, 0 )
widthValidFlag = heightValidFlag = true;
#else
widthValid = heightValid = true; widthValid = heightValid = true;
#endif
} }
} }
@ -130,6 +134,11 @@ void QskQuickItemPrivate::setImplicitSize( qreal w, qreal h, bool doNotify )
implicitWidth = w; implicitWidth = w;
implicitHeight = h; implicitHeight = h;
#if QT_VERSION >= QT_VERSION_CHECK( 6, 2, 0 )
const bool widthValid = widthValidFlag;
const bool heightValid = heightValidFlag;
#endif
if ( !( widthValid && heightValid ) ) if ( !( widthValid && heightValid ) )
{ {
// auto adjusting the size // auto adjusting the size

View File

@ -19,6 +19,13 @@
#include <qvariantanimation.h> #include <qvariantanimation.h>
QSK_QT_PRIVATE_BEGIN QSK_QT_PRIVATE_BEGIN
#if QT_VERSION >= QT_VERSION_CHECK( 6, 2, 0 )
#ifndef emit
// qvariantanimation_p.h needs it
#define emit
#endif
#endif
#include <private/qvariantanimation_p.h> #include <private/qvariantanimation_p.h>
QSK_QT_PRIVATE_END QSK_QT_PRIVATE_END

View File

@ -58,8 +58,13 @@ namespace
{ {
auto d = QQuickTextPrivate::get( this ); auto d = QQuickTextPrivate::get( this );
#if QT_VERSION >= QT_VERSION_CHECK( 6, 2, 0 )
d->heightValidFlag = true;
d->widthValidFlag = true;
#else
d->heightValid = true; d->heightValid = true;
d->widthValid = true; d->widthValid = true;
#endif
if ( ( d->x != rect.x() ) || ( d->y != rect.y() ) ) if ( ( d->x != rect.x() ) || ( d->y != rect.y() ) )
{ {