diff --git a/playground/inputpanel/main.cpp b/playground/inputpanel/main.cpp index 5ab232ee..75173155 100644 --- a/playground/inputpanel/main.cpp +++ b/playground/inputpanel/main.cpp @@ -123,7 +123,7 @@ public: const QFontMetricsF fm( effectiveFont( Text ) ); - for ( auto entry : m_values ) + for ( const auto& entry : m_values ) m_maxWidth = qMax( m_maxWidth, fm.width( entry.first ) ); const QMarginsF padding = marginsHint( Cell | Padding ); diff --git a/qskconfig.pri b/qskconfig.pri index 207cb5c2..789f2071 100644 --- a/qskconfig.pri +++ b/qskconfig.pri @@ -15,14 +15,12 @@ RCC_DIR = rcc QSK_CONFIG += QskDll -linux-g++ | linux-g++-64 { - - # CONFIG += separate_debug_info - - # --- optional warnings +linux { pedantic { + DEFINES += QT_STRICT_ITERATORS + # Qt headers do not stand pedantic checks, so it's better # to exclude them by declaring them as system includes @@ -30,8 +28,20 @@ linux-g++ | linux-g++-64 { -isystem $$[QT_INSTALL_HEADERS] \ -isystem $$[QT_INSTALL_HEADERS]/QtCore \ -isystem $$[QT_INSTALL_HEADERS]/QtGui \ + -isystem $$[QT_INSTALL_HEADERS]/QtGui/$$[QT_VERSION]/QtGui/private \ -isystem $$[QT_INSTALL_HEADERS]/QtQuick \ + -isystem $$[QT_INSTALL_HEADERS]/QtQuick/$$[QT_VERSION]/QtQuick/private \ -isystem $$[QT_INSTALL_HEADERS]/QtQml + } +} + +linux-g++ | linux-g++-64 { + + # CONFIG += separate_debug_info + + # --- optional warnings + + pedantic { QMAKE_CXXFLAGS *= -pedantic-errors QMAKE_CXXFLAGS *= -Wextra @@ -55,8 +65,6 @@ linux-g++ | linux-g++-64 { } } - DEFINES += QT_STRICT_ITERATORS - # --- optional debug options QMAKE_CXXFLAGS_DEBUG *= -fsanitize=address -fno-omit-frame-pointer diff --git a/src/controls/QskControl.cpp b/src/controls/QskControl.cpp index 8824d061..0ed1a031 100644 --- a/src/controls/QskControl.cpp +++ b/src/controls/QskControl.cpp @@ -622,19 +622,13 @@ void QskControl::setBackground( const QskGradient& gradient ) using namespace QskAspect; const Aspect aspect = Control | Color; - if ( autoFillBackground() ) - { - if ( hintTable().gradient( aspect ) != gradient ) - { - setGradientHint( aspect, gradient ); - - // might be wrong, when the effective gradient was from the skin - update(); - } - } - else + if ( hintTable().gradient( aspect ) != gradient ) { setGradientHint( aspect, gradient ); + if ( autoFillBackground() ) + update(); + + Q_EMIT backgroundChanged(); } } @@ -645,20 +639,12 @@ void QskControl::resetBackground() auto& table = hintTable(); - if ( autoFillBackground() ) - { - const auto oldGradient = gradientHint( aspect ); - - if ( table.hint( aspect ).isValid() ) - { - table.removeHint( aspect ); - if ( gradientHint( aspect ) != oldGradient ) - update(); - } - } - else + if ( table.hint( aspect ).isValid() ) { table.removeHint( aspect ); + + update(); + Q_EMIT backgroundChanged(); } } @@ -1198,7 +1184,8 @@ void QskControl::updatePolish() { const QRectF rect = layoutRect(); - for ( auto child : childItems() ) + const auto children = childItems(); + for ( auto child : children ) { if ( !QQuickItemPrivate::get( child )->isTransparentForPositioner() ) { @@ -1334,7 +1321,8 @@ QSizeF QskControl::contentsSizeHint() const if ( d_func()->autoLayoutChildren ) { - for ( const auto child : childItems() ) + const auto children = childItems(); + for ( const auto child : children ) { if ( auto* control = qobject_cast< const QskControl* >( child ) ) { diff --git a/src/controls/QskControl.h b/src/controls/QskControl.h index fee9b2c8..b0d1a84d 100644 --- a/src/controls/QskControl.h +++ b/src/controls/QskControl.h @@ -57,7 +57,7 @@ class QSK_EXPORT QskControl : public QQuickItem, public QskResizable, public Qsk WRITE setMargins RESET resetMargins NOTIFY marginsChanged ) Q_PROPERTY( QskGradient background READ background - WRITE setBackground RESET resetBackground ) + WRITE setBackground RESET resetBackground NOTIFY backgroundChanged ) Q_PROPERTY( QskSizePolicy sizePolicy READ sizePolicy WRITE setSizePolicy ) Q_PROPERTY( QSizeF minimumSize READ minimumSize WRITE setMinimumSize ) @@ -166,6 +166,7 @@ public: QVector< QskAspect::Subcontrol > subControls() const; Q_SIGNALS: + void backgroundChanged(); void marginsChanged(); void localeChanged( const QLocale& ); void controlFlagsChanged(); diff --git a/src/controls/QskDirtyItemFilter.cpp b/src/controls/QskDirtyItemFilter.cpp index 238746fa..fdd99fd5 100644 --- a/src/controls/QskDirtyItemFilter.cpp +++ b/src/controls/QskDirtyItemFilter.cpp @@ -29,7 +29,8 @@ static inline void qskBlockDirty( QQuickItem* item, bool on ) if ( qskIsUpdateBlocked( item ) ) QQuickItemPrivate::get( item )->componentComplete = !on; - for ( auto child : item->childItems() ) + const auto children = item->childItems(); + for ( auto child : children ) qskBlockDirty( child, on ); } diff --git a/src/controls/QskObjectTree.cpp b/src/controls/QskObjectTree.cpp index 276f5aa5..56055db2 100644 --- a/src/controls/QskObjectTree.cpp +++ b/src/controls/QskObjectTree.cpp @@ -19,7 +19,8 @@ QObjectList QskObjectTree::childNodes( const QObject* object ) if ( object == nullptr ) { - for ( QWindow* window : QGuiApplication::topLevelWindows() ) + const auto windows = QGuiApplication::topLevelWindows(); + for ( QWindow* window : windows ) children += window; } else if ( object->isWindowType() ) diff --git a/src/controls/QskSkinFactory.cpp b/src/controls/QskSkinFactory.cpp index a772388e..3d98793f 100644 --- a/src/controls/QskSkinFactory.cpp +++ b/src/controls/QskSkinFactory.cpp @@ -81,7 +81,8 @@ QStringList Qsk::skinNames() { QStringList names; - for ( const auto& factory : qskGetFactoryTable() ) + const auto& factoryTable = qskGetFactoryTable(); + for ( const auto& factory : factoryTable ) { if ( factory ) names += factory->skinNames(); @@ -94,7 +95,8 @@ QskSkin* Qsk::createSkin( const QString& skinName ) { if ( !skinName.isEmpty() ) { - for ( const auto& factory : qskGetFactoryTable() ) + const auto& factoryTable = qskGetFactoryTable(); + for ( const auto& factory : factoryTable ) { QskSkin* skin = factory->createSkin( skinName ); if ( skin ) diff --git a/src/controls/QskSkinnable.cpp b/src/controls/QskSkinnable.cpp index 04d09552..049a7ece 100644 --- a/src/controls/QskSkinnable.cpp +++ b/src/controls/QskSkinnable.cpp @@ -755,7 +755,8 @@ void QskSkinnable::setSkinStateFlag( QskAspect::State state, bool on ) { const auto placement = effectivePlacement(); - for ( const auto subControl : control->subControls() ) + const auto subControls = control->subControls(); + for ( const auto subControl : subControls ) { using namespace QskAspect; diff --git a/src/controls/QskSubWindow.cpp b/src/controls/QskSubWindow.cpp index fafaaeca..4befa219 100644 --- a/src/controls/QskSubWindow.cpp +++ b/src/controls/QskSubWindow.cpp @@ -149,7 +149,8 @@ QSizeF QskSubWindow::contentsSizeHint() const qreal w = -1; qreal h = -1; - for ( auto child : childItems() ) + const auto children = childItems(); + for ( auto child : children ) { if ( isTransparentForPositioner( child ) ) continue; diff --git a/src/dialogs/QskSelectionSubWindow.cpp b/src/dialogs/QskSelectionSubWindow.cpp index 36403cf8..cbd225df 100644 --- a/src/dialogs/QskSelectionSubWindow.cpp +++ b/src/dialogs/QskSelectionSubWindow.cpp @@ -15,11 +15,11 @@ namespace { setObjectName( QStringLiteral( "QskSelectionSubWindowListBox" ) ); - connect( this, SIGNAL( selectedRowChanged( int ) ), - window, SIGNAL( selectedRowChanged( int ) ) ); + connect( this, SIGNAL( selectedRowChanged(int) ), + window, SIGNAL( selectedRowChanged(int) ) ); - connect( this, SIGNAL( selectedEntryChanged( const QString& ) ), - window, SIGNAL( selectedEntryChanged( const QString& ) ) ); + connect( this, SIGNAL( selectedEntryChanged(const QString&) ), + window, SIGNAL( selectedEntryChanged(const QString&) ) ); connect( this, SIGNAL( entriesChanged() ), window, SIGNAL( entriesChanged() ) ); diff --git a/support/SkinnyShortcut.cpp b/support/SkinnyShortcut.cpp index c45ff63c..65372906 100644 --- a/support/SkinnyShortcut.cpp +++ b/support/SkinnyShortcut.cpp @@ -120,7 +120,8 @@ void SkinnyShortcut::showBackground() qskSetup->setControlFlag( QskSetup::DebugForceBackground, forceBackground ); - for ( auto window : QGuiApplication::topLevelWindows() ) + const auto windows = QGuiApplication::topLevelWindows(); + for ( auto window : windows ) { if ( QskWindow* w = qobject_cast< QskWindow* >( window ) ) { @@ -188,14 +189,16 @@ static void countItems( const QQuickItem* item, int counter[4] ) counter[3] += nodeCounter; } - for ( const auto* child : item->childItems() ) + const auto children = item->childItems(); + for ( const auto* child : children ) countItems( child, counter ); } } void SkinnyShortcut::debugStatistics() { - for ( auto window : QGuiApplication::topLevelWindows() ) + const auto windows = QGuiApplication::topLevelWindows(); + for ( auto window : windows ) { const auto w = qobject_cast< const QQuickWindow* >( window ); if ( w == nullptr )