From 13867df163673d128b0a582336fcce376d60207b Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Wed, 14 Jul 2021 14:43:12 +0200 Subject: [PATCH] making clang happy --- examples/iotdashboard/Box.h | 1 - examples/iotdashboard/MenuBar.h | 21 ++++++++++----------- src/common/QskAspect.h | 6 +++--- src/common/QskBoxShapeMetrics.h | 3 ++- src/controls/QskProgressBarSkinlet.cpp | 2 +- src/controls/QskSetup.cpp | 4 ++-- src/graphic/QskGraphic.cpp | 2 +- src/layouts/QskGridLayoutEngine.cpp | 11 +++++++++++ src/layouts/QskLinearLayoutEngine.cpp | 11 +++++++++++ 9 files changed, 41 insertions(+), 20 deletions(-) diff --git a/examples/iotdashboard/Box.h b/examples/iotdashboard/Box.h index 152f3b46..91ff2d74 100644 --- a/examples/iotdashboard/Box.h +++ b/examples/iotdashboard/Box.h @@ -24,7 +24,6 @@ class Box : public QskLinearBox private: QString m_title; QskTextLabel* m_label; - QskControl* m_content; }; #endif // BOX_H diff --git a/examples/iotdashboard/MenuBar.h b/examples/iotdashboard/MenuBar.h index e8afec8c..02d7e931 100644 --- a/examples/iotdashboard/MenuBar.h +++ b/examples/iotdashboard/MenuBar.h @@ -10,7 +10,7 @@ #include #include -class MenuBarTopLabel : public QskGraphicLabel +class MenuBarTopLabel final : public QskGraphicLabel { Q_OBJECT @@ -23,7 +23,7 @@ class MenuBarTopLabel : public QskGraphicLabel } QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final + QskAspect::Subcontrol subControl ) const override { if( subControl == QskGraphicLabel::Graphic ) { @@ -34,7 +34,7 @@ class MenuBarTopLabel : public QskGraphicLabel } }; -class MenuBarGraphicLabel : public QskGraphicLabel +class MenuBarGraphicLabel final : public QskGraphicLabel { Q_OBJECT @@ -47,7 +47,7 @@ class MenuBarGraphicLabel : public QskGraphicLabel } QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final + QskAspect::Subcontrol subControl ) const override { if( subControl == QskGraphicLabel::Graphic ) { @@ -58,7 +58,7 @@ class MenuBarGraphicLabel : public QskGraphicLabel } }; -class MenuBarLabel : public QskTextLabel +class MenuBarLabel final : public QskTextLabel { Q_OBJECT @@ -71,7 +71,7 @@ class MenuBarLabel : public QskTextLabel } QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final + QskAspect::Subcontrol subControl ) const override { if( subControl == QskTextLabel::Text ) { @@ -82,7 +82,7 @@ class MenuBarLabel : public QskTextLabel } }; -class MenuItem : public QskLinearBox +class MenuItem final : public QskLinearBox { Q_OBJECT @@ -92,14 +92,13 @@ class MenuItem : public QskLinearBox MenuItem( const QString& name, QQuickItem* parent ); - QskAspect::Subcontrol effectiveSubcontrol( QskAspect::Subcontrol subControl ) const override final; + QskAspect::Subcontrol effectiveSubcontrol( QskAspect::Subcontrol ) const override; private: QString m_name; - bool m_isActive = false; }; -class MenuBar : public QskLinearBox +class MenuBar final : public QskLinearBox { Q_OBJECT @@ -109,7 +108,7 @@ class MenuBar : public QskLinearBox MenuBar( QQuickItem* parent ); QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final; + QskAspect::Subcontrol ) const override; private: QList< QString > m_entryStrings; diff --git a/src/common/QskAspect.h b/src/common/QskAspect.h index 45558cc6..3709d992 100644 --- a/src/common/QskAspect.h +++ b/src/common/QskAspect.h @@ -523,7 +523,7 @@ QSK_EXPORT void qskDebugAspect( QDebug, const QMetaObject*, QskAspect ); #define QSK_STATE( type, name, value ) \ static_assert( \ - ( value >= QskAspect::FirstUserState ) && ( value <= QskAspect::LastUserState ), \ + ( ( value ) >= QskAspect::FirstUserState ) && ( ( value ) <= QskAspect::LastUserState ), \ "Invalid state" \ ); \ const QskAspect::State type::name = \ @@ -531,8 +531,8 @@ QSK_EXPORT void qskDebugAspect( QDebug, const QMetaObject*, QskAspect ); #define QSK_SYSTEM_STATE( type, name, value ) \ static_assert( \ - ( value >= QskAspect::FirstSystemState && value < QskAspect::FirstUserState ) || \ - ( value > QskAspect::LastUserState && value <= QskAspect::LastSystemState ), \ + ( ( value ) >= QskAspect::FirstSystemState && ( value ) < QskAspect::FirstUserState ) || \ + ( ( value ) > QskAspect::LastUserState && ( value ) <= QskAspect::LastSystemState ), \ "Invalid system state" \ ); \ const QskAspect::State type::name = \ diff --git a/src/common/QskBoxShapeMetrics.h b/src/common/QskBoxShapeMetrics.h index 561e4f55..03677070 100644 --- a/src/common/QskBoxShapeMetrics.h +++ b/src/common/QskBoxShapeMetrics.h @@ -190,7 +190,8 @@ inline void QskBoxShapeMetrics::setRadius( inline constexpr QSizeF QskBoxShapeMetrics::radius( Qt::Corner corner ) const noexcept { - return ( ( corner >= 0 ) && ( corner < 4 ) ) ? m_radii[ corner ] : QSizeF(); + return ( ( static_cast< int >( corner ) >= 0 ) && ( static_cast< int >( corner ) < 4 ) ) + ? m_radii[ corner ] : QSizeF(); } inline void QskBoxShapeMetrics::setSizeMode( Qt::SizeMode sizeMode ) noexcept diff --git a/src/controls/QskProgressBarSkinlet.cpp b/src/controls/QskProgressBarSkinlet.cpp index 56300c18..7ca2df21 100644 --- a/src/controls/QskProgressBarSkinlet.cpp +++ b/src/controls/QskProgressBarSkinlet.cpp @@ -63,7 +63,7 @@ QRectF QskProgressBarSkinlet::subControlRect( { const auto bar = static_cast< const QskProgressBar* >( skinnable ); - if( ( subControl == QskProgressBar::Groove ) ) + if( subControl == QskProgressBar::Groove ) { const auto extent = bar->extent(); diff --git a/src/controls/QskSetup.cpp b/src/controls/QskSetup.cpp index a4875e3e..6b91a4d6 100644 --- a/src/controls/QskSetup.cpp +++ b/src/controls/QskSetup.cpp @@ -195,14 +195,14 @@ QskSkin* QskSetup::setSkin( const QString& skinName ) if ( m_data->skin && ( skinName == m_data->skinName ) ) return m_data->skin; - QskSkin* skin = QskSkinManager::instance()->createSkin( skinName ); + auto skin = QskSkinManager::instance()->createSkin( skinName ); if ( skin == nullptr ) return nullptr; if ( skin->parent() == nullptr ) skin->setParent( this ); - const QskSkin* oldSkin = m_data->skin; + const auto oldSkin = m_data->skin; m_data->skin = skin; m_data->skinName = skinName; diff --git a/src/graphic/QskGraphic.cpp b/src/graphic/QskGraphic.cpp index 7ec46ac1..54f35fd9 100644 --- a/src/graphic/QskGraphic.cpp +++ b/src/graphic/QskGraphic.cpp @@ -1040,7 +1040,7 @@ QDebug operator<<( QDebug debug, const QskGraphic& graphic ) debug << "\n controlPointsRect:" << graphic.boundingRect(); debug << "\n commandTypes:" << graphic.commandTypes(); - for ( const auto command : graphic.commands() ) + for ( const auto& command : graphic.commands() ) { switch ( command.type() ) { diff --git a/src/layouts/QskGridLayoutEngine.cpp b/src/layouts/QskGridLayoutEngine.cpp index 31b32381..0cc0d2d9 100644 --- a/src/layouts/QskGridLayoutEngine.cpp +++ b/src/layouts/QskGridLayoutEngine.cpp @@ -167,6 +167,7 @@ namespace public: Element( QQuickItem*, const QRect& ); Element( const QSizeF& spacing, const QRect& ); + Element( const Element& ); Element& operator=( const Element& ); @@ -210,6 +211,16 @@ Element::Element( const QSizeF& spacing, const QRect& grid ) { } +Element::Element( const Element& other ) + : m_grid( other.m_grid ) + , m_isSpacer (other.m_isSpacer ) +{ + if ( other.m_isSpacer ) + m_spacing = other.m_spacing; + else + m_item = other.m_item; +} + Element& Element::operator=( const Element& other ) { m_isSpacer = other.m_isSpacer; diff --git a/src/layouts/QskLinearLayoutEngine.cpp b/src/layouts/QskLinearLayoutEngine.cpp index 363ba65b..71acef97 100644 --- a/src/layouts/QskLinearLayoutEngine.cpp +++ b/src/layouts/QskLinearLayoutEngine.cpp @@ -18,6 +18,7 @@ namespace public: Element( QQuickItem* item ); Element( qreal spacing ); + Element( const Element& ); Element& operator=( const Element& ); @@ -63,6 +64,16 @@ Element::Element( qreal spacing ) { } +Element::Element( const Element& other ) + : m_stretch( other.m_stretch ) + , m_isSpacer( other.m_isSpacer ) +{ + if ( other.m_isSpacer ) + m_spacing = other.m_spacing; + else + m_item = other.m_item; +} + Element& Element::operator=( const Element& other ) { m_isSpacer = other.m_isSpacer;