From ae2c6d87a8d09ecfe9b4cb9f621baeab6dbdf148 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 8 Mar 2022 11:53:46 +0100 Subject: [PATCH] upport for Qt < Qt 5.12 dropped --- README.md | 4 +- examples/automotive/SpeedometerSkinlet.cpp | 4 -- examples/iotdashboard/MenuBar.cpp | 2 +- features/qskqvg.prf | 36 +++------------- src/common/QskGlobal.h | 17 -------- src/common/QskNamespace.h | 41 +++--------------- src/common/QskObjectCounter.cpp | 4 +- src/common/QskPlatform.cpp | 8 ---- src/controls/QskControl.cpp | 49 ---------------------- src/controls/QskEvent.cpp | 2 - src/controls/QskFocusIndicator.cpp | 2 +- src/controls/QskGestureRecognizer.cpp | 4 +- src/controls/QskInputGrabber.cpp | 18 -------- src/controls/QskListView.cpp | 5 +-- src/controls/QskQuick.cpp | 16 +------ src/controls/QskQuickItem.cpp | 18 +------- src/controls/QskQuickItem.h | 13 ------ src/controls/QskScrollArea.cpp | 10 ----- src/controls/QskShortcutMap.cpp | 4 +- src/controls/QskSkinManager.cpp | 2 +- src/controls/QskSkinnable.cpp | 11 ----- src/controls/QskTextInput.cpp | 18 +------- src/controls/QskTextInput.h | 8 ---- src/controls/QskWindow.cpp | 29 ------------- src/controls/QskWindow.h | 4 -- src/dialogs/QskDialogButtonBox.cpp | 9 +--- src/graphic/QskGraphic.cpp | 4 +- src/layouts/QskStackBox.cpp | 2 +- src/nodes/QskTickmarksNode.cpp | 4 -- 29 files changed, 32 insertions(+), 316 deletions(-) diff --git a/README.md b/README.md index 9831aa97..25e19754 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,9 @@ controls is limited to the needs of the driving projects. QSkinny is supposed to run on all platforms being supported by Qt/Quick. But so far only Linux is actively tested. -It might support all versions Qt >= 5.6, but you can rely on: +It might support all versions Qt >= 5.12, but you can rely on: -- Qt 5.6 +- Qt 5.15 - current long term supported ( LTS ) version of Qt - current version of Qt diff --git a/examples/automotive/SpeedometerSkinlet.cpp b/examples/automotive/SpeedometerSkinlet.cpp index 05b1333b..5eff6632 100644 --- a/examples/automotive/SpeedometerSkinlet.cpp +++ b/examples/automotive/SpeedometerSkinlet.cpp @@ -28,11 +28,7 @@ namespace LinesNode( int lineCount = 0 ) : m_geometry( QSGGeometry::defaultAttributes_Point2D(), 2 * lineCount ) { -#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 ) m_geometry.setDrawingMode( QSGGeometry::DrawLines ); -#else - m_geometry.setDrawingMode( GL_LINES ); -#endif m_geometry.setVertexDataPattern( QSGGeometry::StaticPattern ); setGeometry( &m_geometry ); diff --git a/examples/iotdashboard/MenuBar.cpp b/examples/iotdashboard/MenuBar.cpp index 817d95bf..ccbcd5d3 100644 --- a/examples/iotdashboard/MenuBar.cpp +++ b/examples/iotdashboard/MenuBar.cpp @@ -46,7 +46,7 @@ MenuBar::MenuBar( QQuickItem* parent ) m_entryStrings = { "Dashboard", "Rooms", "Devices", "Statistics", "Storage", "Members" }; - for( const auto& entryString : qskAsConst( m_entryStrings ) ) + for( const auto& entryString : qAsConst( m_entryStrings ) ) { auto* entry = new MenuItem( entryString, this ); m_entries.append( entry ); diff --git a/features/qskqvg.prf b/features/qskqvg.prf index 6664192b..39f25b4e 100644 --- a/features/qskqvg.prf +++ b/features/qskqvg.prf @@ -31,40 +31,16 @@ qvgrcc.CONFIG += add_inputs_as_makefile_deps QRC_SHADOW_CLONE = $$shell_path( $${OUT_PWD}/${QMAKE_FILE_BASE}_shadow.qrc ) qtPrepareTool(QMAKE_RCC, rcc, _DEP) -lessThan(QT_MAJOR_VERSION, 6): lessThan(QT_MINOR_VERSION, 12) { +equals( OUT_PWD, $${_PRO_FILE_PWD_} ) { - # Since Qt 5.12 "rcc --list" works for qvg files, that do not yet exist - # To get these rules working for earlier versions we derive the qvg - # files from the SVGSOURCES - - defineReplace(qvgfiles) { - - svgfiles = $$1 - - files = - for( svgfile, svgfiles) { - filename = $$basename( svgfile ) - files += $$shell_path( $${QVG_DIR}/$$replace( filename, svg, qvg ) ) - } - - return( $$files ) - } - - qvgrcc.depends += $$qvgfiles( $${SVGSOURCES} ) + qvgrcc.depend_command = $$QMAKE_RCC_DEP -list $$QMAKE_RESOURCE_FLAGS ${QMAKE_FILE_IN} } else { - equals( OUT_PWD, $${_PRO_FILE_PWD_} ) { - - qvgrcc.depend_command = $$QMAKE_RCC_DEP -list $$QMAKE_RESOURCE_FLAGS ${QMAKE_FILE_IN} - - } else { - - qvgrcc.depend_command = \ - $${QMAKE_COPY} ${QMAKE_FILE_IN} $${QRC_SHADOW_CLONE} && \ - $$QMAKE_RCC_DEP -list $$QMAKE_RESOURCE_FLAGS $${QRC_SHADOW_CLONE} && \ - $${QMAKE_DEL_FILE} $${QRC_SHADOW_CLONE} - } + qvgrcc.depend_command = \ + $${QMAKE_COPY} ${QMAKE_FILE_IN} $${QRC_SHADOW_CLONE} && \ + $$QMAKE_RCC_DEP -list $$QMAKE_RESOURCE_FLAGS $${QRC_SHADOW_CLONE} && \ + $${QMAKE_DEL_FILE} $${QRC_SHADOW_CLONE} } equals( OUT_PWD, $${_PRO_FILE_PWD_} ) { diff --git a/src/common/QskGlobal.h b/src/common/QskGlobal.h index a4451f77..56361c17 100644 --- a/src/common/QskGlobal.h +++ b/src/common/QskGlobal.h @@ -39,23 +39,6 @@ #define QSK_QT_PRIVATE_END \ QT_WARNING_POP -#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 ) - -#define qskAsConst qAsConst - -#else - -template< typename T > -struct QskAddConst { typedef const T Type; }; - -template< typename T > -constexpr typename QskAddConst< T >::Type& qskAsConst( T& t ) noexcept { return t; } - -template< typename T > -void qskAsConst( const T&& ) = delete; - -#endif - #ifdef Q_FALLTHROUGH #define QSK_FALLTHROUGH Q_FALLTHROUGH #else diff --git a/src/common/QskNamespace.h b/src/common/QskNamespace.h index 73f33939..0e1872e3 100644 --- a/src/common/QskNamespace.h +++ b/src/common/QskNamespace.h @@ -9,36 +9,9 @@ #include "QskGlobal.h" #include -#if QT_VERSION < QT_VERSION_CHECK( 5, 8, 0 ) - // hack to run moc over a namespace - - #ifdef Q_MOC_RUN - - #define QSK_NAMESPACE( name ) struct 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 - - #define QSK_NAMESPACE( name ) namespace name - #define QSK_ENUM Q_ENUM_NS - - #define QSK_Q_NAMESPACE Q_NAMESPACE -#endif - -QSK_NAMESPACE( Qsk ) +namespace Qsk { - QSK_EXPORT QSK_Q_NAMESPACE + QSK_EXPORT Q_NAMESPACE enum Direction { @@ -47,7 +20,7 @@ QSK_NAMESPACE( Qsk ) TopToBottom, BottomToTop }; - QSK_ENUM( Direction ) + Q_ENUM_NS( Direction ) enum Position { @@ -56,7 +29,7 @@ QSK_NAMESPACE( Qsk ) Right, Bottom }; - QSK_ENUM( Position ) + Q_ENUM_NS( Position ) enum TextStyle { @@ -65,11 +38,7 @@ QSK_NAMESPACE( Qsk ) Raised, Sunken }; - QSK_ENUM( TextStyle ) + Q_ENUM_NS( TextStyle ) } -#undef QSK_NAMESPACE -#undef QSK_ENUM -#undef QSK_Q_NAMESPACE - #endif diff --git a/src/common/QskObjectCounter.cpp b/src/common/QskObjectCounter.cpp index 7cc95051..61d6b6ec 100644 --- a/src/common/QskObjectCounter.cpp +++ b/src/common/QskObjectCounter.cpp @@ -162,7 +162,7 @@ void CounterHook::addObject( QObject* object ) { const bool isItem = qskIsItem( object ); - for ( auto counterData : qskAsConst( m_counterDataSet ) ) + for ( auto counterData : qAsConst( m_counterDataSet ) ) { counterData->counter[ QskObjectCounter::Objects ].increment(); @@ -182,7 +182,7 @@ void CounterHook::removeObject( QObject* object ) { const bool isItem = qskIsItem( object ); - for ( auto counterData : qskAsConst( m_counterDataSet ) ) + for ( auto counterData : qAsConst( m_counterDataSet ) ) { counterData->counter[ QskObjectCounter::Objects ].decrement(); diff --git a/src/common/QskPlatform.cpp b/src/common/QskPlatform.cpp index 062c1064..67fbfdf1 100644 --- a/src/common/QskPlatform.cpp +++ b/src/common/QskPlatform.cpp @@ -5,14 +5,6 @@ QSK_QT_PRIVATE_BEGIN #include - -#if QT_VERSION < QT_VERSION_CHECK( 5, 8, 0 ) - #ifndef foreach - // qhighdpiscaling_p.h needs it - #define foreach Q_FOREACH - #endif -#endif - #include QSK_QT_PRIVATE_END diff --git a/src/controls/QskControl.cpp b/src/controls/QskControl.cpp index 5edd886e..a0aff322 100644 --- a/src/controls/QskControl.cpp +++ b/src/controls/QskControl.cpp @@ -758,55 +758,6 @@ bool QskControl::event( QEvent* event ) bool QskControl::childMouseEventFilter( QQuickItem* item, QEvent* event ) { -#if QT_VERSION < QT_VERSION_CHECK( 5, 10, 0 ) - - if ( event->type() == QEvent::MouseButtonPress ) - { - auto me = static_cast< QMouseEvent* >( event ); - - if ( me->source() == Qt::MouseEventSynthesizedByQt ) - { - /* - Unhandled touch events result in creating synthetic - mouse events. For all versions < 5.10 those events are - passed through childMouseEventFilter without doing the - extra checks, that are done for real mouse events. - Furthermore the coordinates are relative - to this - not to item. - - To avoid having a different behavior between using - mouse and touch, we do those checks here. - */ - - auto itm = item; - auto pos = item->mapFromScene( me->windowPos() ); - - for ( itm = item; itm != this; itm = itm->parentItem() ) - { - if ( itm->acceptedMouseButtons() & me->button() ) - { - if ( itm->contains( pos ) ) - break; - } - - pos += QPointF( itm->x(), itm->y() ); - } - - if ( itm != item ) - { - if ( itm == this ) - return false; - - QScopedPointer< QMouseEvent > clonedEvent( - QQuickWindowPrivate::cloneMouseEvent( me, &pos ) ); - - return d_func()->maybeGesture( itm, clonedEvent.data() ); - } - } - } - -#endif - return d_func()->maybeGesture( item, event ); } diff --git a/src/controls/QskEvent.cpp b/src/controls/QskEvent.cpp index 6a77d9b8..84d16d8b 100644 --- a/src/controls/QskEvent.cpp +++ b/src/controls/QskEvent.cpp @@ -105,10 +105,8 @@ qreal qskWheelIncrement( const QWheelEvent* event ) auto angleDelta = event->angleDelta(); -#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 ) if ( event->inverted() ) angleDelta.setY( -angleDelta.y() ); -#endif const qreal delta = angleDelta.y() ? angleDelta.y() : angleDelta.x(); return delta / QWheelEvent::DefaultDeltasPerStep; diff --git a/src/controls/QskFocusIndicator.cpp b/src/controls/QskFocusIndicator.cpp index 42a12bb8..5e4f18aa 100644 --- a/src/controls/QskFocusIndicator.cpp +++ b/src/controls/QskFocusIndicator.cpp @@ -49,7 +49,7 @@ class QskFocusIndicator::PrivateData public: void resetConnections() { - for ( const auto& connection : qskAsConst( connections ) ) + for ( const auto& connection : qAsConst( connections ) ) QObject::disconnect( connection ); connections.clear(); diff --git a/src/controls/QskGestureRecognizer.cpp b/src/controls/QskGestureRecognizer.cpp index cd15a1f5..dc75d3c8 100644 --- a/src/controls/QskGestureRecognizer.cpp +++ b/src/controls/QskGestureRecognizer.cpp @@ -130,7 +130,7 @@ namespace { Timer* timer = nullptr; - for ( auto t : qskAsConst( m_table ) ) + for ( auto t : qAsConst( m_table ) ) { if ( t->recognizer() == nullptr || t->recognizer() == recognizer ) @@ -151,7 +151,7 @@ namespace void stopTimer( const QskGestureRecognizer* recognizer ) { - for ( auto timer : qskAsConst( m_table ) ) + for ( auto timer : qAsConst( m_table ) ) { if ( timer->recognizer() == recognizer ) { diff --git a/src/controls/QskInputGrabber.cpp b/src/controls/QskInputGrabber.cpp index f5d5d224..2bad7493 100644 --- a/src/controls/QskInputGrabber.cpp +++ b/src/controls/QskInputGrabber.cpp @@ -74,7 +74,6 @@ class QskInputGrabber::PrivateData final : public QQuickItemChangeListener } private: -#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 ) void itemGeometryChanged( QQuickItem* item, QQuickGeometryChange change, const QRectF& ) override { @@ -88,21 +87,6 @@ class QskInputGrabber::PrivateData final : public QQuickItemChangeListener if ( doUpdate ) m_grabber->updateGeometry(); } -#else - void itemGeometryChanged( - QQuickItem* item, const QRectF& newRect, const QRectF& oldRect ) override - { - bool doUpdate = false; - - if ( item == itemAbove ) - doUpdate = newRect.topLeft() != oldRect.topLeft(); - else - doUpdate = newRect.size() != oldRect.size(); - - if ( doUpdate ) - m_grabber->updateGeometry(); - } -#endif void itemParentChanged( QQuickItem* item, QQuickItem* parentItem ) override { @@ -125,9 +109,7 @@ QskInputGrabber::QskInputGrabber( QQuickItem* parent ) , m_data( new PrivateData( this ) ) { setAcceptedMouseButtons( Qt::AllButtons ); -#if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 ) setAcceptTouchEvents( true ); -#endif setAcceptHoverEvents( true ); setTransparentForPositioner( true ); diff --git a/src/controls/QskListView.cpp b/src/controls/QskListView.cpp index 550ed06c..f0a30301 100644 --- a/src/controls/QskListView.cpp +++ b/src/controls/QskListView.cpp @@ -323,10 +323,7 @@ QPointF QskListView::scrollOffset( const QWheelEvent* event ) const const auto viewHeight = viewContentsRect().height(); const qreal rowHeight = this->rowHeight(); - int numLines = 3; -#if QT_VERSION >= QT_VERSION_CHECK( 5, 9, 0 ) - numLines = QGuiApplication::styleHints()->wheelScrollLines(); -#endif + const int numLines = QGuiApplication::styleHints()->wheelScrollLines(); qreal dy = numLines * rowHeight; if ( event->modifiers() & ( Qt::ControlModifier | Qt::ShiftModifier ) ) diff --git a/src/controls/QskQuick.cpp b/src/controls/QskQuick.cpp index 8f6d4f22..b4dabdc4 100644 --- a/src/controls/QskQuick.cpp +++ b/src/controls/QskQuick.cpp @@ -58,19 +58,7 @@ bool qskIsAncestorOf( const QQuickItem* item, const QQuickItem* child ) if ( item == nullptr || child == nullptr ) return false; -#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 ) return item->isAncestorOf( child ); -#else - while ( child ) - { - if ( child == item ) - return true; - - child = child->parentItem(); - } - - return false; -#endif } bool qskIsVisibleToParent( const QQuickItem* item ) @@ -645,7 +633,7 @@ void qskItemUpdateRecursive( QQuickItem* item ) qskItemUpdateRecursive( child ); } -#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 ) && QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) +#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) static const QQuickPointerTouchEvent* qskPointerPressEvent( const QQuickWindowPrivate* wd ) { @@ -682,7 +670,7 @@ bool qskGrabMouse( QQuickItem* item ) item->setKeepMouseGrab( true ); -#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 ) && QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) +#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) auto wd = QQuickWindowPrivate::get( item->window() ); if ( wd->touchMouseDevice == nullptr ) diff --git a/src/controls/QskQuickItem.cpp b/src/controls/QskQuickItem.cpp index e8165233..8bb22370 100644 --- a/src/controls/QskQuickItem.cpp +++ b/src/controls/QskQuickItem.cpp @@ -157,12 +157,6 @@ QskQuickItem::QskQuickItem( QskQuickItemPrivate& dd, QQuickItem* parent ) { setFlag( QQuickItem::ItemHasContents, true ); -#if QT_VERSION < QT_VERSION_CHECK( 5, 10, 0 ) - // since Qt 5.10 we have QQuickItem::ItemEnabledHasChanged - connect( this, &QQuickItem::enabledChanged, - this, &QskQuickItem::sendEnabledChangeEvent ); -#endif - if ( dd.updateFlags & QskQuickItem::DeferredUpdate ) qskFilterWindow( window() ); @@ -180,11 +174,6 @@ QskQuickItem::~QskQuickItem() if ( qskRegistry ) qskRegistry->remove( this ); - -#if QT_VERSION < QT_VERSION_CHECK( 5, 10, 0 ) - disconnect( this, &QQuickItem::enabledChanged, - this, &QskQuickItem::sendEnabledChangeEvent ); -#endif } const char* QskQuickItem::className() const @@ -597,11 +586,6 @@ void QskQuickItem::resetImplicitSize() } } -void QskQuickItem::sendEnabledChangeEvent() -{ - qskSendEventTo( this, QEvent::EnabledChange ); -} - bool QskQuickItem::event( QEvent* event ) { const int eventType = event->type(); @@ -796,7 +780,7 @@ void QskQuickItem::itemChange( QQuickItem::ItemChange change, #if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 ) case QQuickItem::ItemEnabledHasChanged: { - sendEnabledChangeEvent(); + qskSendEventTo( this, QEvent::EnabledChange ); break; } #endif diff --git a/src/controls/QskQuickItem.h b/src/controls/QskQuickItem.h index 0256430d..c66f7826 100644 --- a/src/controls/QskQuickItem.h +++ b/src/controls/QskQuickItem.h @@ -63,9 +63,6 @@ class QSK_EXPORT QskQuickItem : public QQuickItem bool hasChildItems() const; QRectF rect() const; -#if QT_VERSION < QT_VERSION_CHECK( 5, 10, 0 ) - QSizeF size() const; -#endif QSizeF implicitSize() const; void setGeometry( qreal x, qreal y, qreal width, qreal height ); @@ -168,7 +165,6 @@ class QSK_EXPORT QskQuickItem : public QQuickItem void childrenRect() = delete; void applyUpdateFlag( UpdateFlag, bool on ); - void sendEnabledChangeEvent(); QSGNode* updatePaintNode( QSGNode*, UpdatePaintNodeData* ) override final; virtual QSGNode* updateItemPaintNode( QSGNode* ); @@ -204,15 +200,6 @@ inline void QskQuickItem::setSize( qreal width, qreal height ) QQuickItem::setSize( QSizeF( width, height ) ); } -#if QT_VERSION < QT_VERSION_CHECK( 5, 10, 0 ) - -inline QSizeF QskQuickItem::size() const -{ - return QSizeF( width(), height() ); -} - -#endif - inline QSizeF QskQuickItem::implicitSize() const { return QSizeF( implicitWidth(), implicitHeight() ); diff --git a/src/controls/QskScrollArea.cpp b/src/controls/QskScrollArea.cpp index 6a90730a..e2078c2b 100644 --- a/src/controls/QskScrollArea.cpp +++ b/src/controls/QskScrollArea.cpp @@ -241,7 +241,6 @@ namespace void itemChange( ItemChange, const ItemChangeData& ) override; -#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 ) void itemGeometryChanged( QQuickItem*, QQuickGeometryChange change, const QRectF& ) override { @@ -249,15 +248,6 @@ namespace scrolledItemGeometryChange(); } -#else - void itemGeometryChanged( QQuickItem*, - const QRectF& newRect, const QRectF& oldRect ) override - { - if ( oldRect.size() != newRect.size() ) - scrolledItemGeometryChange(); - } -#endif - void updateNode( QSGNode* ) override; private: diff --git a/src/controls/QskShortcutMap.cpp b/src/controls/QskShortcutMap.cpp index 27f5a07e..0cd743df 100644 --- a/src/controls/QskShortcutMap.cpp +++ b/src/controls/QskShortcutMap.cpp @@ -173,7 +173,7 @@ void QskShortcutHandler::remove( int id ) Finally let's check if we can disconnect from the destroyed signals */ - for ( const auto& entry : qskAsConst( m_invokeDataMap ) ) + for ( const auto& entry : qAsConst( m_invokeDataMap ) ) { if ( item == nullptr && receiver == nullptr ) break; @@ -276,7 +276,7 @@ bool QskShortcutHandler::invoke( QQuickItem* item, const QKeySequence& sequence { bool found = false; - for ( const auto& entry : qskAsConst( m_invokeDataMap ) ) + for ( const auto& entry : qAsConst( m_invokeDataMap ) ) { auto& data = entry.second; diff --git a/src/controls/QskSkinManager.cpp b/src/controls/QskSkinManager.cpp index 287a363e..807753c1 100644 --- a/src/controls/QskSkinManager.cpp +++ b/src/controls/QskSkinManager.cpp @@ -341,7 +341,7 @@ class QskSkinManager::PrivateData { if ( !pluginsRegistered ) { - for ( const auto& path : qskAsConst( pluginPaths ) ) + for ( const auto& path : qAsConst( pluginPaths ) ) registerPlugins( path + QStringLiteral( "/skins" ) ); pluginsRegistered = true; diff --git a/src/controls/QskSkinnable.cpp b/src/controls/QskSkinnable.cpp index 9801f35d..9c9d8726 100644 --- a/src/controls/QskSkinnable.cpp +++ b/src/controls/QskSkinnable.cpp @@ -35,18 +35,7 @@ static inline bool qskIsControl( const QskSkinnable* skinnable ) { -#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 ) return skinnable->metaObject()->inherits( &QskControl::staticMetaObject ); -#else - for ( auto mo = skinnable->metaObject(); - mo != nullptr; mo = mo->superClass() ) - { - if ( mo == &QskControl::staticMetaObject ) - return true; - } - - return false; -#endif } static inline QVariant qskTypedNullValue( const QVariant& value ) diff --git a/src/controls/QskTextInput.cpp b/src/controls/QskTextInput.cpp index 229d0def..b16b8e7c 100644 --- a/src/controls/QskTextInput.cpp +++ b/src/controls/QskTextInput.cpp @@ -36,10 +36,8 @@ static inline void qskBindSignals( QObject::connect( wrappedInput, &QQuickTextInput::displayTextChanged, input, [ input ] { Q_EMIT input->displayTextChanged( input->displayText() ); } ); -#if QT_VERSION >= QT_VERSION_CHECK( 5, 9, 0 ) QObject::connect( wrappedInput, &QQuickTextInput::textEdited, input, [ input ] { Q_EMIT input->textEdited( input->text() ); } ); -#endif QObject::connect( wrappedInput, &QQuickTextInput::validatorChanged, input, &QskTextInput::validatorChanged ); @@ -50,10 +48,8 @@ static inline void qskBindSignals( QObject::connect( wrappedInput, &QQuickTextInput::readOnlyChanged, input, [ input ] { qskPropagateReadOnly( input ); } ); -#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 ) QObject::connect( wrappedInput, &QQuickTextInput::overwriteModeChanged, input, &QskTextInput::overwriteModeChanged ); -#endif QObject::connect( wrappedInput, &QQuickTextInput::maximumLengthChanged, input, &QskTextInput::maximumLengthChanged ); @@ -219,9 +215,7 @@ namespace return; setCursorVisible( on ); -#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 ) d->setBlinkingCursorEnabled( on ); -#endif if ( !on ) { @@ -561,11 +555,7 @@ void QskTextInput::setActivationModes( ActivationModes modes ) static inline void qskUpdateInputMethodFont( const QskTextInput* input ) { - auto queries = Qt::ImCursorRectangle | Qt::ImFont; -#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 ) - queries |= Qt::ImAnchorRectangle; -#endif - + const auto queries = Qt::ImCursorRectangle | Qt::ImFont | Qt::ImAnchorRectangle; qskUpdateInputMethod( input, queries ); } @@ -785,8 +775,6 @@ QString QskTextInput::preeditText() const return d->m_textLayout.preeditAreaText(); } -#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 ) - bool QskTextInput::overwriteMode() const { return m_data->textInput->overwriteMode(); @@ -797,8 +785,6 @@ void QskTextInput::setOverwriteMode( bool overwrite ) m_data->textInput->setOverwriteMode( overwrite ); } -#endif - bool QskTextInput::hasAcceptableInput() const { return m_data->textInput->hasAcceptableInput(); @@ -832,9 +818,7 @@ QVariant QskTextInput::inputMethodQuery( { return locale(); } -#if QT_VERSION >= QT_VERSION_CHECK( 5, 7, 0 ) case Qt::ImInputItemClipRectangle: -#endif case Qt::ImCursorRectangle: { QVariant v = m_data->textInput->inputMethodQuery( query, argument ); diff --git a/src/controls/QskTextInput.h b/src/controls/QskTextInput.h index a9493463..c4a798eb 100644 --- a/src/controls/QskTextInput.h +++ b/src/controls/QskTextInput.h @@ -137,10 +137,8 @@ class QSK_EXPORT QskTextInput : public QskControl QString displayText() const; QString preeditText() const; -#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 ) bool overwriteMode() const; void setOverwriteMode( bool ); -#endif bool hasAcceptableInput() const; bool fixup(); @@ -170,20 +168,14 @@ class QSK_EXPORT QskTextInput : public QskControl void textChanged( const QString& ); void displayTextChanged( const QString& ); -#if QT_VERSION >= QT_VERSION_CHECK( 5, 9, 0 ) void textEdited( const QString& ); -#endif - void descriptionChanged( const QString& ); void textOptionsChanged(); void fontRoleChanged(); void alignmentChanged(); -#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 ) void overwriteModeChanged( bool ); -#endif - void maximumLengthChanged( int ); void echoModeChanged( EchoMode ); diff --git a/src/controls/QskWindow.cpp b/src/controls/QskWindow.cpp index 92b20f23..0be35d4a 100644 --- a/src/controls/QskWindow.cpp +++ b/src/controls/QskWindow.cpp @@ -201,37 +201,8 @@ QskWindow::QskWindow( QQuickRenderControl* renderControl, QWindow* parent ) QskWindow::~QskWindow() { -#if QT_VERSION < QT_VERSION_CHECK( 5, 12, 0 ) - // When being used from Qml the item destruction would run in the most - // unefficient way, leading to lots of QQuickItem::ItemChildRemovedChange - // depending operations. - - QVector< QPointer< QQuickItem > > items; - - const auto children = contentItem()->childItems(); - for ( auto child : children ) - { - if ( child->parent() == contentItem() ) - items += child; - } - - for ( auto& item : qskAsConst( items ) ) - delete item; -#endif } -#if QT_VERSION < QT_VERSION_CHECK( 5, 9, 0 ) - -void QskWindow::setFlag(Qt::WindowType flag, bool on) -{ - if( on ) - setFlags( flags() | flag ); - else - setFlags( flags() & ~flag ); -} - -#endif - void QskWindow::setScreen( const QString& name ) { if ( !name.isEmpty() ) diff --git a/src/controls/QskWindow.h b/src/controls/QskWindow.h index de5ef4a5..8a2a158f 100644 --- a/src/controls/QskWindow.h +++ b/src/controls/QskWindow.h @@ -43,10 +43,6 @@ class QSK_EXPORT QskWindow : public QQuickWindow using Inherited::setScreen; void setScreen( const QString& ); -#if QT_VERSION < QT_VERSION_CHECK( 5, 9, 0 ) - void setFlag( Qt::WindowType, bool on = true ); -#endif - bool deleteOnClose() const; void setDeleteOnClose( bool ); diff --git a/src/dialogs/QskDialogButtonBox.cpp b/src/dialogs/QskDialogButtonBox.cpp index 440c1142..95b905bf 100644 --- a/src/dialogs/QskDialogButtonBox.cpp +++ b/src/dialogs/QskDialogButtonBox.cpp @@ -131,7 +131,7 @@ QskDialogButtonBox::~QskDialogButtonBox() { for ( int i = 0; i < QskDialog::NActionRoles; i++ ) { - for ( auto button : qskAsConst( m_data->buttons[ i ] ) ) + for ( auto button : qAsConst( m_data->buttons[ i ] ) ) { /* The destructor of QQuickItem sets the parentItem of @@ -595,14 +595,9 @@ QString QskDialogButtonBox::buttonText( QskDialog::Action action ) { // should be redirected through the skin ! - const QPlatformTheme* theme = QGuiApplicationPrivate::platformTheme(); + const auto theme = QGuiApplicationPrivate::platformTheme(); QString text = theme->standardButtonText( action ); - -#if QT_VERSION < QT_VERSION_CHECK( 5, 7, 0 ) - text.remove( '&' ); -#else text = QPlatformTheme::removeMnemonics( text ); -#endif return text; } diff --git a/src/graphic/QskGraphic.cpp b/src/graphic/QskGraphic.cpp index 2705baf7..ab6e6b30 100644 --- a/src/graphic/QskGraphic.cpp +++ b/src/graphic/QskGraphic.cpp @@ -565,7 +565,7 @@ QRectF QskGraphic::scaledBoundingRect( qreal sx, qreal sy ) const QRectF rect = transform.mapRect( m_data->pointRect ); - for ( const auto& info : qskAsConst( m_data->pathInfos ) ) + for ( const auto& info : qAsConst( m_data->pathInfos ) ) rect |= info.scaledBoundingRect( sx, sy, scalePens ); return rect; @@ -678,7 +678,7 @@ void QskGraphic::render( QPainter* painter, const QRectF& rect, const bool scalePens = !( m_data->renderHints & RenderPensUnscaled ); - for ( const auto& info : qskAsConst( m_data->pathInfos ) ) + for ( const auto& info : qAsConst( m_data->pathInfos ) ) { const qreal ssx = info.scaleFactorX( m_data->pointRect, rect, scalePens ); diff --git a/src/layouts/QskStackBox.cpp b/src/layouts/QskStackBox.cpp index e2054d1e..7d6a03fc 100644 --- a/src/layouts/QskStackBox.cpp +++ b/src/layouts/QskStackBox.cpp @@ -316,7 +316,7 @@ void QskStackBox::autoRemoveItem( QQuickItem* item ) void QskStackBox::clear( bool autoDelete ) { - for ( const auto item : qskAsConst( m_data->items ) ) + for ( const auto item : qAsConst( m_data->items ) ) { if( autoDelete && ( item->parent() == this ) ) delete item; diff --git a/src/nodes/QskTickmarksNode.cpp b/src/nodes/QskTickmarksNode.cpp index ab1d3f59..bf06f862 100644 --- a/src/nodes/QskTickmarksNode.cpp +++ b/src/nodes/QskTickmarksNode.cpp @@ -21,11 +21,7 @@ class QskTickmarksNodePrivate final : public QSGGeometryNodePrivate QskTickmarksNodePrivate() : geometry( QSGGeometry::defaultAttributes_Point2D(), 0 ) { -#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 ) geometry.setDrawingMode( QSGGeometry::DrawLines ); -#else - geometry.setDrawingMode( GL_LINES ); -#endif geometry.setVertexDataPattern( QSGGeometry::StaticPattern ); }