diff --git a/examples/gallery/button/ButtonPage.cpp b/examples/gallery/button/ButtonPage.cpp index 03166754..3026561a 100644 --- a/examples/gallery/button/ButtonPage.cpp +++ b/examples/gallery/button/ButtonPage.cpp @@ -18,7 +18,7 @@ namespace { public: ButtonBox( Qt::Orientation orientation, QQuickItem* parent = nullptr ) - : ButtonBox( orientation, -1, parent ) + : ButtonBox( orientation, std::numeric_limits< uint >::max(), parent ) { } diff --git a/examples/gallery/dialog/DialogPage.cpp b/examples/gallery/dialog/DialogPage.cpp index 9af09429..c1b9ffc8 100644 --- a/examples/gallery/dialog/DialogPage.cpp +++ b/examples/gallery/dialog/DialogPage.cpp @@ -30,7 +30,7 @@ namespace TypeCount }; - Q_ENUM( ButtonType ); + Q_ENUM( ButtonType ) Button( ButtonType type, QQuickItem* parent = nullptr ) : QskPushButton( parent ) diff --git a/examples/iotdashboard/CircularProgressBar.h b/examples/iotdashboard/CircularProgressBar.h index efb71b9d..a198c647 100644 --- a/examples/iotdashboard/CircularProgressBar.h +++ b/examples/iotdashboard/CircularProgressBar.h @@ -28,7 +28,7 @@ class CircularProgressBar : public QskBoundedControl CircularProgressBar( qreal min, qreal max, QQuickItem* parent = nullptr ); CircularProgressBar( QQuickItem* parent = nullptr ); - ~CircularProgressBar(); + ~CircularProgressBar() override; bool isIndeterminate() const; void setIndeterminate( bool on = true ); diff --git a/examples/iotdashboard/DiagramSkinlet.cpp b/examples/iotdashboard/DiagramSkinlet.cpp index a5505d30..d6570fa9 100644 --- a/examples/iotdashboard/DiagramSkinlet.cpp +++ b/examples/iotdashboard/DiagramSkinlet.cpp @@ -118,7 +118,7 @@ QSGNode* DiagramSkinlet::updateChartNode( const Diagram* diagram, QSGNode* node QskAspect::Subcontrol areaSubcontrol = subcontrolForIndex( Diagram::Area, i ); QskAspect::Subcontrol barSubcontrol = subcontrolForIndex( Diagram::Bar, i ); - int lineWidth = diagram->metric( lineSubcontrol | QskAspect::Size ); + const auto lineWidth = diagram->metric( lineSubcontrol | QskAspect::Size ); for( const auto type : { Diagram::Line, Diagram::Area, Diagram::Bar } ) { diff --git a/examples/iotdashboard/LightDisplaySkinlet.cpp b/examples/iotdashboard/LightDisplaySkinlet.cpp index ecb17879..6602a2f3 100644 --- a/examples/iotdashboard/LightDisplaySkinlet.cpp +++ b/examples/iotdashboard/LightDisplaySkinlet.cpp @@ -31,8 +31,7 @@ LightDisplaySkinlet::~LightDisplaySkinlet() QRectF LightDisplaySkinlet::subControlRect( const QskSkinnable* skinnable, const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const { - auto* display = static_cast< const LightDisplay* >( skinnable ); - QRectF rect = contentsRect; + auto display = static_cast< const LightDisplay* >( skinnable ); const qreal ticksSpacing = 4; // space between the ticks and the arc if( subControl == LightDisplay::Groove || subControl == LightDisplay::Panel ) @@ -50,25 +49,23 @@ QRectF LightDisplaySkinlet::subControlRect( const QskSkinnable* skinnable, const qreal diameter = qMin( w, h ); - rect = QRectF( x, y, diameter, diameter ); - return rect; + return QRectF( x, y, diameter, diameter ); } else if( subControl == LightDisplay::ColdAndWarmArc ) { const QRectF panelRect = subControlRect( skinnable, contentsRect, LightDisplay::Panel ); - auto barWidth = display->arcMetricsHint( LightDisplay::ColdAndWarmArc ).width(); - auto rect = panelRect.marginsAdded( { barWidth, barWidth, barWidth, barWidth } ); - return rect; + const auto barWidth = display->arcMetricsHint( LightDisplay::ColdAndWarmArc ).width(); + + return panelRect.marginsAdded( { barWidth, barWidth, barWidth, barWidth } ); } else if( subControl == LightDisplay::Tickmarks ) { - const QRectF arcRect = subControlRect( + const auto arcRect = subControlRect( skinnable, contentsRect, LightDisplay::ColdAndWarmArc ); const qreal ticksWidth = display->arcMetricsHint( LightDisplay::Tickmarks ).width() + ticksSpacing; - const QRectF rect = - arcRect.marginsAdded( { ticksWidth, ticksWidth, ticksWidth, ticksWidth } ); - return rect; + + return arcRect.marginsAdded( { ticksWidth, ticksWidth, ticksWidth, ticksWidth } ); } else if( subControl == LightDisplay::ValueText ) { @@ -76,14 +73,18 @@ QRectF LightDisplaySkinlet::subControlRect( const QskSkinnable* skinnable, const QFontMetricsF fm( skinnable->effectiveFont( subControl ) ); const qreal fontWidth = qskHorizontalAdvance( fm, QStringLiteral( "100 %" ) ); const QPointF center = valueTextRect.center(); - const QRectF rect( center.x() - fontWidth / 2, center.y() - fm.height() / 2, fontWidth, fm.height() ); - return rect; + + return QRectF( + center.x() - fontWidth / 2, center.y() - fm.height() / 2, + fontWidth, fm.height() ); } else if( subControl == LightDisplay::LeftLabel ) { - const QRectF ticksRect = subControlRect( skinnable, contentsRect, LightDisplay::Tickmarks ); + const QRectF ticksRect = subControlRect( + skinnable, contentsRect, LightDisplay::Tickmarks ); const auto size = textLabelsSize( display ); + auto rect = contentsRect; rect.setWidth( size.width() ); rect.setY( ticksRect.y() + ( ticksRect.height() - size.height() ) / 2 ); @@ -96,6 +97,7 @@ QRectF LightDisplaySkinlet::subControlRect( const QskSkinnable* skinnable, const auto ticksRect = subControlRect( skinnable, contentsRect, LightDisplay::Tickmarks ); const auto size = textLabelsSize( display ); + auto rect = contentsRect; rect.setX( ticksRect.x() + ticksRect.width() ); rect.setY( ticksRect.y() + ( ticksRect.height() - size.height() ) / 2 ); @@ -119,8 +121,7 @@ QRectF LightDisplaySkinlet::subControlRect( const QskSkinnable* skinnable, const auto x = arcRect.center().x() - knobSize.width() / 2 - radius * cos; const auto y = arcRect.center().y() - knobSize.height() / 2 - radius * sin; - rect = QRectF( x, y, knobSize.width(), knobSize.height() ); - return rect; + return QRectF( x, y, knobSize.width(), knobSize.height() ); } return contentsRect; diff --git a/examples/iotdashboard/nodes/DiagramSegmentsNode.cpp b/examples/iotdashboard/nodes/DiagramSegmentsNode.cpp index 976abae7..860073b3 100644 --- a/examples/iotdashboard/nodes/DiagramSegmentsNode.cpp +++ b/examples/iotdashboard/nodes/DiagramSegmentsNode.cpp @@ -19,7 +19,7 @@ DiagramSegmentsNode::DiagramSegmentsNode() void DiagramSegmentsNode::update( const QRectF& rect, const QColor& color, const QVector< QVector< QPointF > >& dataPoints, int xGridLines ) { - Q_UNUSED( rect ); + Q_UNUSED( rect ) if( color != m_color ) { diff --git a/examples/tabview/main.cpp b/examples/tabview/main.cpp index 11ffd12f..be97c590 100644 --- a/examples/tabview/main.cpp +++ b/examples/tabview/main.cpp @@ -72,7 +72,6 @@ class TabView : public QskTabView { for ( int i = 0; i < 10; i++ ) { - QString text; if ( i == 4 ) { const auto text = QStringLiteral( "Another Tab" ); diff --git a/examples/thumbnails/main.cpp b/examples/thumbnails/main.cpp index 68de7927..dd9f4e6f 100644 --- a/examples/thumbnails/main.cpp +++ b/examples/thumbnails/main.cpp @@ -158,7 +158,7 @@ class IconGrid : public QskLinearBox private: void setItemsVisible( const QRectF& rect, bool on ) { - const int dim = dimension(); + const auto dim = dimension(); // we know, that all items have the same size const auto itemSize = itemAtIndex( 0 )->size(); diff --git a/inputcontext/QskInputContextPlugin.cpp b/inputcontext/QskInputContextPlugin.cpp index 5243b79e..f44102ba 100644 --- a/inputcontext/QskInputContextPlugin.cpp +++ b/inputcontext/QskInputContextPlugin.cpp @@ -24,7 +24,7 @@ class QskPlatformInputContext final : public QPlatformInputContext public: QskPlatformInputContext(); - virtual ~QskPlatformInputContext() = default; + ~QskPlatformInputContext() override = default; bool isValid() const override; bool hasCapability( Capability ) const override; diff --git a/playground/anchors/AnchorBox.cpp b/playground/anchors/AnchorBox.cpp index 593409ed..d3e401f9 100644 --- a/playground/anchors/AnchorBox.cpp +++ b/playground/anchors/AnchorBox.cpp @@ -132,10 +132,10 @@ void LayoutSolver::setup( bool layoutChildren, const auto expr1 = r1.expressionAt( anchor.edge1 ); - Expression expr2; - if ( anchor.item2 == nullptr ) { + Expression expr2; + switch( anchor.edge2 ) { case Qt::AnchorLeft: diff --git a/playground/invoker/main.cpp b/playground/invoker/main.cpp index 9b1935fb..169c5372 100644 --- a/playground/invoker/main.cpp +++ b/playground/invoker/main.cpp @@ -10,35 +10,12 @@ #include #include -void debugNone1() -{ - qDebug() << "None 1"; -} - -void debugNone2() -{ - qDebug() << "None 2"; -} - -void debugValueI1( int i ) -{ - qDebug() << "I1" << i; -} - -void debugValueI2( int i ) -{ - qDebug() << "I2" << i; -} - -void debugValueD( qreal d ) -{ - qDebug() << "D" << d; -} - -void debugValue( qreal d, int i ) -{ - qDebug() << d << i; -} +static void debugNone1() { qDebug() << "None 1"; } +static void debugNone2() { qDebug() << "None 2"; } +static void debugValueI1( int i ) { qDebug() << "I1" << i; } +static void debugValueI2( int i ) { qDebug() << "I2" << i; } +static void debugValueD( qreal d ) { qDebug() << "D" << d; } +static void debugValue( qreal d, int i ) { qDebug() << d << i; } class MyObject : public QObject { @@ -166,7 +143,7 @@ class Application : public QCoreApplication #endif } - virtual ~Application() + ~Application() override { delete m_object; } diff --git a/playground/shapes/GeometricShape.h b/playground/shapes/GeometricShape.h index 1d60cbeb..1b26da9f 100644 --- a/playground/shapes/GeometricShape.h +++ b/playground/shapes/GeometricShape.h @@ -29,7 +29,7 @@ class GeometricShape : public ShapeItem Hexagon, Arc }; - Q_ENUM( Figure ); + Q_ENUM( Figure ) GeometricShape( QQuickItem* parent = nullptr ); GeometricShape( Figure figure, QQuickItem* parent = nullptr ); diff --git a/playground/shapes/Stroke.cpp b/playground/shapes/Stroke.cpp index 0336ee78..4e60725a 100644 --- a/playground/shapes/Stroke.cpp +++ b/playground/shapes/Stroke.cpp @@ -8,7 +8,7 @@ Stroke::Stroke( const QPen& pen ) noexcept : m_width( pen.widthF() ) - , m_miterLimit( pen.miterLimit() ) + , m_miterLimit( qRound( pen.miterLimit() ) ) , m_color( pen.color() ) , m_lineStyle( ( pen.style() == Qt::DashLine ) ? DashLine : SolidLine ) , m_joinStyle( static_cast< JoinStyle >( pen.joinStyle() ) ) diff --git a/qmlexport/QskQml.hpp b/qmlexport/QskQml.hpp index c120ee65..5e0844dd 100644 --- a/qmlexport/QskQml.hpp +++ b/qmlexport/QskQml.hpp @@ -202,7 +202,7 @@ namespace QskQml return qmlregister( TypeRegistration, &type ); } - int registerUncreatableMetaObject( + inline int registerUncreatableMetaObject( const QMetaObject& staticMetaObject, const char* qmlName ) { using namespace QQmlPrivate; diff --git a/skins/material3/QskMaterial3Skin.cpp b/skins/material3/QskMaterial3Skin.cpp index 9907088f..9b889ebd 100644 --- a/skins/material3/QskMaterial3Skin.cpp +++ b/skins/material3/QskMaterial3Skin.cpp @@ -58,12 +58,12 @@ static const int qskDuration = 150; namespace { - inline double operator ""_dp( long double value ) + Q_DECL_UNUSED inline double operator ""_dp( long double value ) { return qskDpToPixels( static_cast< qreal >( value ) ); } - inline double operator ""_dp( unsigned long long value ) + Q_DECL_UNUSED inline double operator ""_dp( unsigned long long value ) { return qskDpToPixels( value ); } @@ -115,25 +115,17 @@ namespace return QskGraphicIO::read( path ); } - void setStandardSymbol( QskAspect aspect, - QskStandardSymbol::Type symbolType ) - { - setSymbol( aspect, QskStandardSymbol::graphic( symbolType ) ); - } - const QskMaterial3Theme& m_pal; }; - QFont createFont( const QString& name, int lineHeight, - int size, qreal tracking, QFont::Weight weight ) + QFont createFont( const QString& name, qreal lineHeight, + qreal size, qreal tracking, QFont::Weight weight ) { - QFont font( name, size ); - font.setPixelSize( lineHeight ); + QFont font( name, qRound( size ) ); + font.setPixelSize( qRound( lineHeight ) ); if( !qskFuzzyCompare( tracking, 0.0 ) ) - { font.setLetterSpacing( QFont::AbsoluteSpacing, tracking ); - } font.setWeight( weight ); @@ -498,8 +490,8 @@ void Editor::setupSegmentedBar() using A = QskAspect; using Q = QskSegmentedBar; - const QSize panelStrutSize( -1, 48_dp ); - const QSize segmentStrutSize( 48_dp, 40_dp ); + const QSizeF panelStrutSize( -1, 48_dp ); + const QSizeF segmentStrutSize( 48_dp, 40_dp ); { // Container diff --git a/skins/squiek/QskSquiekSkin.cpp b/skins/squiek/QskSquiekSkin.cpp index 7364a52a..a720ae53 100644 --- a/skins/squiek/QskSquiekSkin.cpp +++ b/skins/squiek/QskSquiekSkin.cpp @@ -53,12 +53,12 @@ static const int qskDuration = 200; namespace { - inline double operator ""_dp( long double value ) + Q_DECL_UNUSED inline double operator ""_dp( long double value ) { return qskDpToPixels( static_cast< qreal >( value ) ); } - inline double operator ""_dp( unsigned long long value ) + Q_DECL_UNUSED inline double operator ""_dp( unsigned long long value ) { return qskDpToPixels( value ); } @@ -571,7 +571,7 @@ void Editor::setupSegmentedBar() setBoxBorderColors( Q::Panel, borderColors ); - const QSize strutSize( 100_dp, 50_dp ); + const QSizeF strutSize( 100_dp, 50_dp ); setStrutSize( Q::Panel | A::Horizontal, strutSize ); setStrutSize( Q::Panel | A::Vertical, strutSize.transposed() ); diff --git a/src/common/QskBoxShapeMetrics.h b/src/common/QskBoxShapeMetrics.h index b87263d5..31882e86 100644 --- a/src/common/QskBoxShapeMetrics.h +++ b/src/common/QskBoxShapeMetrics.h @@ -59,7 +59,7 @@ class QSK_EXPORT QskBoxShapeMetrics Proportional }; - Q_ENUM( ScalingMode ); + Q_ENUM( ScalingMode ) constexpr QskBoxShapeMetrics() noexcept; diff --git a/src/common/QskGradient.cpp b/src/common/QskGradient.cpp index ff0d9b2e..c317aadf 100644 --- a/src/common/QskGradient.cpp +++ b/src/common/QskGradient.cpp @@ -327,7 +327,7 @@ int QskGradient::stepCount() const noexcept if ( !isValid() ) return 0; - int steps = m_stops.count() - 1; + auto steps = static_cast< int >( m_stops.count() ) - 1; if ( m_stops.first().position() > 0.0 ) steps++; diff --git a/src/common/QskGradientStop.cpp b/src/common/QskGradientStop.cpp index 94854c68..1181d621 100644 --- a/src/common/QskGradientStop.cpp +++ b/src/common/QskGradientStop.cpp @@ -102,8 +102,10 @@ QDebug operator<<( QDebug debug, const QskGradientStop& stop ) static inline QColor qskInterpolatedColor( const QskGradientStops& stops, int index1, int index2, qreal position ) { - index1 = qBound( 0, index1, stops.count() - 1 ); - index2 = qBound( 0, index2, stops.count() - 1 ); + const auto max = static_cast< int >( stops.count() ) - 1; + + index1 = qBound( 0, index1, max ); + index2 = qBound( 0, index2, max ); return QskGradientStop::interpolated( stops[ index1 ], stops[ index2 ], position ); } @@ -138,7 +140,7 @@ QskGradientStops qskTransparentGradientStops( const QskGradientStops& stops, qre for ( auto& stop : newStops ) { auto c = stop.color(); - c.setAlpha( c.alpha() * ratio ); + c.setAlpha( qRound( c.alpha() * ratio ) ); stop.setColor( c ); } diff --git a/src/common/QskHctColor.cpp b/src/common/QskHctColor.cpp index 78adff96..e745cc1e 100644 --- a/src/common/QskHctColor.cpp +++ b/src/common/QskHctColor.cpp @@ -544,7 +544,7 @@ static XYZ nthVertex( double y, int n ) return { -1.0, -1.0, -1.0 }; } -void bisectToSegment( double y, double targetHue, XYZ& left, XYZ& right ) +static void bisectToSegment( double y, double targetHue, XYZ& left, XYZ& right ) { left = { -1.0, -1.0, -1.0 }; right = left; diff --git a/src/common/QskMetaFunction.cpp b/src/common/QskMetaFunction.cpp index 7d817cb9..ba5f51b5 100644 --- a/src/common/QskMetaFunction.cpp +++ b/src/common/QskMetaFunction.cpp @@ -154,7 +154,7 @@ int QskMetaFunction::returnType() const size_t QskMetaFunction::parameterCount() const { - int count = 0; + size_t count = 0; if ( auto types = parameterTypes() ) { diff --git a/src/common/QskMetaFunction.hpp b/src/common/QskMetaFunction.hpp index 419ec0bf..57fe4d7d 100644 --- a/src/common/QskMetaFunction.hpp +++ b/src/common/QskMetaFunction.hpp @@ -35,9 +35,9 @@ class QskMetaFunction::FunctionCall : public QtPrivate::QSlotObjectBase protected: explicit inline FunctionCall( InvokeFunction f, - const int* m_parameterTypes = nullptr ): + const int* parameterTypes = nullptr ): QSlotObjectBase( f ), - m_parameterTypes( m_parameterTypes ) + m_parameterTypes( parameterTypes ) { } diff --git a/src/common/QskMetaInvokable.cpp b/src/common/QskMetaInvokable.cpp index da217c27..157c02a2 100644 --- a/src/common/QskMetaInvokable.cpp +++ b/src/common/QskMetaInvokable.cpp @@ -152,7 +152,7 @@ QMetaMethod qskNotifySignal( const QMetaObject* metaObject, const char* property static void qskInvokeMetaCall( QObject* object, const QMetaObject* metaObject, - QMetaObject::Call call, int offset, int index, void* argv[], + QMetaObject::Call call, ushort offset, ushort index, void* argv[], Qt::ConnectionType connectionType ) { QPointer< QObject > receiver( object ); @@ -196,6 +196,7 @@ static void qskInvokeMetaCall( QSemaphore semaphore; + Q_ASSERT( metaObject == nullptr || receiver->metaObject() == metaObject ); qskInvokeMetaCallQueued( receiver, call, offset, index, argv, &semaphore ); @@ -256,6 +257,7 @@ static void qskInvokeMetaCall( return; } + Q_ASSERT( metaObject == nullptr || receiver->metaObject() == metaObject ); qskInvokeMetaCallQueued( object, call, offset, index, arguments, nullptr ); break; diff --git a/src/common/QskMetaInvokable.h b/src/common/QskMetaInvokable.h index c257c8d7..68ab8d6b 100644 --- a/src/common/QskMetaInvokable.h +++ b/src/common/QskMetaInvokable.h @@ -132,8 +132,8 @@ QSK_EXPORT void qskInvokeMetaPropertyWrite( void* args[], Qt::ConnectionType = Qt::AutoConnection ); QSK_EXPORT void qskInvokeMetaPropertyWrite( - const QObject* object, const QMetaProperty&, - void* args[], Qt::ConnectionType = Qt::AutoConnection ); + QObject*, const QMetaProperty&, void* args[], + Qt::ConnectionType = Qt::AutoConnection ); QSK_EXPORT QMetaMethod qskNotifySignal( const QMetaObject*, const char* propertyName ); QSK_EXPORT QMetaMethod qskNotifySignal( const QObject*, const char* propertyName ); diff --git a/src/common/QskScaleTickmarks.cpp b/src/common/QskScaleTickmarks.cpp index 65f67089..7673920a 100644 --- a/src/common/QskScaleTickmarks.cpp +++ b/src/common/QskScaleTickmarks.cpp @@ -27,15 +27,17 @@ QskScaleTickmarks::~QskScaleTickmarks() int QskScaleTickmarks::tickCount() const noexcept { - return m_ticks[ MajorTick ].count() + const auto count = m_ticks[ MajorTick ].count() + m_ticks[ MediumTick ].count() + m_ticks[ MinorTick ].count(); + + return static_cast< int >( count ); } int QskScaleTickmarks::tickCount( TickType type ) const noexcept { - return m_ticks[ type ].count(); + return static_cast< int >( m_ticks[ type ].count() ); } QVector< qreal > QskScaleTickmarks::ticks( TickType type ) const noexcept diff --git a/src/controls/QskMenuSkinlet.h b/src/controls/QskMenuSkinlet.h index a64de72e..e8b5754b 100644 --- a/src/controls/QskMenuSkinlet.h +++ b/src/controls/QskMenuSkinlet.h @@ -25,7 +25,7 @@ class QSK_EXPORT QskMenuSkinlet : public QskPopupSkinlet }; Q_INVOKABLE QskMenuSkinlet( QskSkin* = nullptr ); - ~QskMenuSkinlet(); + ~QskMenuSkinlet() override; QRectF subControlRect( const QskSkinnable*, const QRectF&, QskAspect::Subcontrol ) const override; diff --git a/src/controls/QskPopup.cpp b/src/controls/QskPopup.cpp index af88d277..c03ddcf1 100644 --- a/src/controls/QskPopup.cpp +++ b/src/controls/QskPopup.cpp @@ -382,9 +382,11 @@ bool QskPopup::hasFaderEffect() const void QskPopup::setPopupFlags( PopupFlags flags ) { - if ( static_cast< int >( flags ) != m_data->flags ) + const auto newFlags = static_cast< int >( flags ); + + if ( newFlags != m_data->flags ) { - m_data->flags = flags; + m_data->flags = newFlags; updateInputGrabber(); } } diff --git a/src/controls/QskPopupSkinlet.cpp b/src/controls/QskPopupSkinlet.cpp index 3a034bde..80bd5a43 100644 --- a/src/controls/QskPopupSkinlet.cpp +++ b/src/controls/QskPopupSkinlet.cpp @@ -16,7 +16,7 @@ namespace class RootNode : public QSGNode { public: - ~RootNode() + ~RootNode() override { delete m_clipNode; delete m_transformNode; diff --git a/src/controls/QskProgressBarSkinlet.cpp b/src/controls/QskProgressBarSkinlet.cpp index c860d316..cd8de5c2 100644 --- a/src/controls/QskProgressBarSkinlet.cpp +++ b/src/controls/QskProgressBarSkinlet.cpp @@ -85,7 +85,6 @@ QRectF QskProgressBarSkinlet::subControlRect( if( subControl == QskProgressBar::Bar ) { - const auto bar = static_cast< const QskProgressBar* >( skinnable ); return barRect( bar ); } diff --git a/src/controls/QskRadioBox.cpp b/src/controls/QskRadioBox.cpp index f120a245..9dade1b1 100644 --- a/src/controls/QskRadioBox.cpp +++ b/src/controls/QskRadioBox.cpp @@ -177,16 +177,13 @@ void QskRadioBox::keyPressEvent( QKeyEvent* event ) } else { - setFocusedIndex( ( float ) nextTabIndex ); + setFocusedIndex( nextTabIndex ); const auto aspect = Ripple | QskAspect::Metric | QskAspect::Position; const auto hint = animationHint( aspect | skinStates() ); if( hint.isValid() ) - { - startTransition( aspect, hint, - ( float ) currentTabIndex, ( float ) nextTabIndex ); - } + startTransition( aspect, hint, currentTabIndex, nextTabIndex ); } update(); diff --git a/src/controls/QskRadioBoxSkinlet.cpp b/src/controls/QskRadioBoxSkinlet.cpp index 2aa01747..46a6f374 100644 --- a/src/controls/QskRadioBoxSkinlet.cpp +++ b/src/controls/QskRadioBoxSkinlet.cpp @@ -9,6 +9,7 @@ #include "QskFunctions.h" #include +#include namespace { @@ -83,7 +84,7 @@ QSGNode* QskRadioBoxSkinlet::updateSubNode( const QskSkinnable* skinnable, case RippleRole: return updateBoxNode( skinnable, node, Q::Ripple ); - }; + } return Inherited::updateSubNode( skinnable, nodeRole, node ); } @@ -100,7 +101,7 @@ QRectF QskRadioBoxSkinlet::rippleRect( { using Q = QskRadioBox; - const auto index = radioBox->positionHint( Q::Ripple ); + const auto index = qFloor( radioBox->positionHint( Q::Ripple ) ); if( index < 0 ) return QRectF(); diff --git a/src/controls/QskScrollArea.cpp b/src/controls/QskScrollArea.cpp index 7f0ba937..b5438f16 100644 --- a/src/controls/QskScrollArea.cpp +++ b/src/controls/QskScrollArea.cpp @@ -201,7 +201,7 @@ namespace public: ClipItem( QskScrollArea* ); - virtual ~ClipItem(); + ~ClipItem() override; void enableGeometryListener( bool on ); diff --git a/src/controls/QskSkin.cpp b/src/controls/QskSkin.cpp index 8015fe6e..a350f83c 100644 --- a/src/controls/QskSkin.cpp +++ b/src/controls/QskSkin.cpp @@ -251,7 +251,7 @@ void QskSkin::setupFonts( const QString& family, int weight, bool italic ) for ( int i = TinyFont; i <= HugeFont; i++ ) { - font.setPixelSize( qskDpToPixels( sizes[i - 1] ) ); + font.setPixelSize( qRound( qskDpToPixels( sizes[i - 1] ) ) ); m_data->fonts[ i ] = font; } diff --git a/src/controls/QskSkinManager.cpp b/src/controls/QskSkinManager.cpp index 9ad83b32..f9e0749c 100644 --- a/src/controls/QskSkinManager.cpp +++ b/src/controls/QskSkinManager.cpp @@ -203,23 +203,6 @@ namespace return m_skinMap.keys(); } - QStringList skinNames( const QString& factoryId ) const - { - const auto it = m_factoryMap.constFind( factoryId ); - if ( it != m_factoryMap.constEnd() ) - { - const auto& data = it.value(); - - if ( data.factory ) - return data.factory->skinNames(); - - if ( data.loader ) - return data.loader->skinNames(); - } - - return QStringList(); - } - void insertFactory( FactoryLoader* loader ) { auto& data = m_factoryMap[ loader->factoryId() ]; @@ -251,11 +234,11 @@ namespace void removeFactory( const QString& factoryId ) { - const auto it = m_factoryMap.find( factoryId ); - if ( it == m_factoryMap.end() ) + const auto itFactory = m_factoryMap.find( factoryId ); + if ( itFactory == m_factoryMap.end() ) return; - m_factoryMap.erase( it ); + m_factoryMap.erase( itFactory ); if ( m_isValid ) { diff --git a/src/controls/QskSkinTransition.cpp b/src/controls/QskSkinTransition.cpp index b805fd5f..b660699c 100644 --- a/src/controls/QskSkinTransition.cpp +++ b/src/controls/QskSkinTransition.cpp @@ -160,7 +160,7 @@ namespace Q_OBJECT public: - ~ApplicationAnimator(); + ~ApplicationAnimator() override; WindowAnimator* windowAnimator( const QQuickWindow* ); diff --git a/src/controls/QskSkinnable.cpp b/src/controls/QskSkinnable.cpp index 89e25b0d..d6ce3af1 100644 --- a/src/controls/QskSkinnable.cpp +++ b/src/controls/QskSkinnable.cpp @@ -753,10 +753,12 @@ QskColorFilter QskSkinnable::effectiveGraphicFilter( aspect.setSection( QskAspect::Body ); aspect.setVariation( QskAspect::NoVariation ); - const auto v = animatedHint( aspect, nullptr ); + { + const auto v = animatedHint( aspect, nullptr ); - if ( v.canConvert< QskColorFilter >() ) - return v.value< QskColorFilter >(); + if ( v.canConvert< QskColorFilter >() ) + return v.value< QskColorFilter >(); + } if ( auto control = owningControl() ) { @@ -816,16 +818,18 @@ QskAnimationHint QskSkinnable::effectiveAnimation( QskAnimationHint hint; - const auto a = m_data->hintTable.resolvedAnimator( aspect, hint ); - if ( a.isAnimator() ) { - if ( status ) + const auto a = m_data->hintTable.resolvedAnimator( aspect, hint ); + if ( a.isAnimator() ) { - status->source = QskSkinHintStatus::Skinnable; - status->aspect = a; - } + if ( status ) + { + status->source = QskSkinHintStatus::Skinnable; + status->aspect = a; + } - return hint; + return hint; + } } if ( auto skin = effectiveSkin() ) @@ -1390,9 +1394,9 @@ bool QskSkinnable::startHintTransitions( that differ between the states */ - for ( uint i = 0; i < primitiveCount; i++ ) + for ( uint j = 0; j < primitiveCount; j++ ) { - const auto primitive = static_cast< QskAspect::Primitive >( i ); + const auto primitive = static_cast< QskAspect::Primitive >( j ); aspect.setPrimitive( type, primitive ); const auto a1 = aspect | oldStates; diff --git a/src/controls/QskTabBar.cpp b/src/controls/QskTabBar.cpp index d5bf7f4f..2d476740 100644 --- a/src/controls/QskTabBar.cpp +++ b/src/controls/QskTabBar.cpp @@ -184,7 +184,7 @@ namespace auto boxSize = viewContentsRect().size(); boxSize = qskConstrainedItemSize( box, boxSize ); - if ( auto box = buttonBox() ) + if ( box ) box->setSize( boxSize ); enableAutoTranslation( false ); diff --git a/src/graphic/QskGraphicIO.cpp b/src/graphic/QskGraphicIO.cpp index f67d1b4a..e5f46461 100644 --- a/src/graphic/QskGraphicIO.cpp +++ b/src/graphic/QskGraphicIO.cpp @@ -138,7 +138,7 @@ static inline void qskReadStateData( quint16 flags; s >> flags; - data.flags = ( QPaintEngine::DirtyFlags ) flags; + data.flags = static_cast< QPaintEngine::DirtyFlags >( flags ); if ( data.flags & QPaintEngine::DirtyPen ) s >> data.pen; @@ -316,7 +316,7 @@ bool QskGraphicIO::write( const QskGraphic& graphic, QIODevice* dev ) stream.setByteOrder( QDataStream::BigEndian ); stream.writeRawData( qskMagicNumber, 4 ); - const int numCommands = graphic.commands().size(); + const auto numCommands = graphic.commands().size(); const QskPainterCommand* cmds = graphic.commands().constData(); stream << static_cast< quint32 >( numCommands ); diff --git a/src/graphic/QskGraphicImageProvider.cpp b/src/graphic/QskGraphicImageProvider.cpp index d88d740d..b79f1ca4 100644 --- a/src/graphic/QskGraphicImageProvider.cpp +++ b/src/graphic/QskGraphicImageProvider.cpp @@ -32,7 +32,7 @@ static inline QSize qskGraphicSize( const QskGraphic& graphic, if ( requestedSize.width() < 0 ) { const auto f = requestedSize.height() / defaultSize.height(); - return QSize( f * defaultSize.width(), + return QSize( static_cast< int >( f * defaultSize.width() ), static_cast< int >( requestedSize.height() ) ); } diff --git a/src/inputpanel/QskInputContext.cpp b/src/inputpanel/QskInputContext.cpp index a42f2d16..2edb0e48 100644 --- a/src/inputpanel/QskInputContext.cpp +++ b/src/inputpanel/QskInputContext.cpp @@ -554,7 +554,7 @@ QskTextPredictor* QskInputContextFactory::createPredictor( const QLocale& locale #if HUNSPELL return new QskHunspellTextPredictor( locale ); #else - Q_UNUSED( locale ); + Q_UNUSED( locale ) #endif return nullptr; diff --git a/src/inputpanel/QskInputContext.h b/src/inputpanel/QskInputContext.h index d11e671f..7b661bbf 100644 --- a/src/inputpanel/QskInputContext.h +++ b/src/inputpanel/QskInputContext.h @@ -48,7 +48,7 @@ class QSK_EXPORT QskInputContext : public QObject public: QskInputContext(); - virtual ~QskInputContext(); + ~QskInputContext() override; void setFactory( QskInputContextFactory* ); QskInputContextFactory* factory() const; diff --git a/src/inputpanel/QskInputPanel.cpp b/src/inputpanel/QskInputPanel.cpp index 308bb484..1e0e60f9 100644 --- a/src/inputpanel/QskInputPanel.cpp +++ b/src/inputpanel/QskInputPanel.cpp @@ -148,16 +148,14 @@ namespace // Let the input field update right away, otherwise // we'll get weird effects with fast backspace presses: Q_EMIT keyProcessingFinished( m_currentResult ); - return; } else { m_currentResult.key = Qt::Key_Backspace; Q_EMIT keyProcessingFinished( m_currentResult ); - return; } - break; + return; } case Qt::Key_Return: { diff --git a/src/layouts/QskGridBox.cpp b/src/layouts/QskGridBox.cpp index fbee94af..71cff4b4 100644 --- a/src/layouts/QskGridBox.cpp +++ b/src/layouts/QskGridBox.cpp @@ -518,10 +518,10 @@ void QskGridBox::dump() const if ( auto item = engine.itemAt( i ) ) { - const auto constraint = qskSizeConstraint( item, Qt::PreferredSize ); + const auto size = qskSizeConstraint( item, Qt::PreferredSize ); debug << item->metaObject()->className() - << " w:" << constraint.width() << " h:" << constraint.height(); + << " w:" << size.width() << " h:" << size.height(); } else { diff --git a/src/layouts/QskGridLayoutEngine.cpp b/src/layouts/QskGridLayoutEngine.cpp index 92cce6bd..75f1cd6e 100644 --- a/src/layouts/QskGridLayoutEngine.cpp +++ b/src/layouts/QskGridLayoutEngine.cpp @@ -485,11 +485,11 @@ int QskGridLayoutEngine::insertSpacer( const QSizeF& spacing, const QRect& grid bool QskGridLayoutEngine::removeAt( int index ) { - const auto element = m_data->elementAt( index ); - if ( element == nullptr ) + const auto elementAt = m_data->elementAt( index ); + if ( elementAt == nullptr ) return false; - const auto grid = element->minimumGrid(); + const auto grid = elementAt->minimumGrid(); auto& elements = m_data->elements; elements.erase( elements.begin() + index ); @@ -504,10 +504,10 @@ bool QskGridLayoutEngine::removeAt( int index ) for ( const auto& element : elements ) { - const auto grid = element.minimumGrid(); + const auto minGrid = element.minimumGrid(); - maxRow = qMax( maxRow, grid.bottom() ); - maxColumn = qMax( maxColumn, grid.right() ); + maxRow = qMax( maxRow, minGrid.bottom() ); + maxColumn = qMax( maxColumn, minGrid.right() ); } m_data->rowCount = maxRow + 1; diff --git a/src/layouts/QskLayoutChain.cpp b/src/layouts/QskLayoutChain.cpp index 4b66122a..051508c3 100644 --- a/src/layouts/QskLayoutChain.cpp +++ b/src/layouts/QskLayoutChain.cpp @@ -250,7 +250,7 @@ QskLayoutChain::Segments QskLayoutChain::segments( qreal size ) const const qreal padding = size - m_boundingMetrics.maximum(); qreal offset = 0.0; - qreal extra = 0.0;; + qreal extra = 0.0; switch( m_fillMode ) { @@ -424,13 +424,13 @@ QskLayoutChain::Segments QskLayoutChain::preferredStretched( qreal size ) const if ( factors[i] < 0.0 ) continue; - const auto size = sumSizes * factors[i] / sumFactors; + const auto sz = sumSizes * factors[i] / sumFactors; const auto& hint = m_cells[i].metrics; const auto boundedSize = - qBound( hint.preferred(), size, hint.maximum() ); + qBound( hint.preferred(), sz, hint.maximum() ); - if ( boundedSize != size ) + if ( boundedSize != sz ) { segments[i].length = boundedSize; sumSizes -= boundedSize; diff --git a/src/layouts/QskLinearBox.cpp b/src/layouts/QskLinearBox.cpp index 6248d458..3703a115 100644 --- a/src/layouts/QskLinearBox.cpp +++ b/src/layouts/QskLinearBox.cpp @@ -556,9 +556,9 @@ void QskLinearBox::dump() const if ( auto item = engine.itemAt( i ) ) { - const auto constraint = qskSizeConstraint( item, Qt::PreferredSize ); + const auto size = qskSizeConstraint( item, Qt::PreferredSize ); debug << item->metaObject()->className() - << " w:" << constraint.width() << " h:" << constraint.height(); + << " w:" << size.width() << " h:" << size.height(); } else { diff --git a/src/layouts/QskStackBox.cpp b/src/layouts/QskStackBox.cpp index caf2bf52..fcadb7a3 100644 --- a/src/layouts/QskStackBox.cpp +++ b/src/layouts/QskStackBox.cpp @@ -450,9 +450,9 @@ void QskStackBox::dump() const debug << " " << i << ": "; - const auto constraint = qskSizeConstraint( item, Qt::PreferredSize ); + const auto size = qskSizeConstraint( item, Qt::PreferredSize ); debug << item->metaObject()->className() - << " w:" << constraint.width() << " h:" << constraint.height(); + << " w:" << size.width() << " h:" << size.height(); if ( i == m_data->currentIndex ) debug << " [X]"; diff --git a/src/nodes/QskArcNode.cpp b/src/nodes/QskArcNode.cpp index a905ffcf..955ffc8b 100644 --- a/src/nodes/QskArcNode.cpp +++ b/src/nodes/QskArcNode.cpp @@ -50,6 +50,4 @@ QskHashValue QskArcNode::hash( const void* nodeData ) const auto h = arcData->metrics.hash(); return arcData->gradient.hash( h ); - - return h; } diff --git a/src/nodes/QskBoxBasicStroker.cpp b/src/nodes/QskBoxBasicStroker.cpp index b245ba5e..b4913b05 100644 --- a/src/nodes/QskBoxBasicStroker.cpp +++ b/src/nodes/QskBoxBasicStroker.cpp @@ -31,7 +31,7 @@ namespace } inline int edgeToIndex( Qt::Edge edge ) - { return qCountTrailingZeroBits( (quint8) edge ); } + { return qCountTrailingZeroBits( static_cast< quint8 >( edge ) ); } class CornerIterator : public QskVertex::ArcIterator { diff --git a/src/nodes/QskBoxGradientStroker.cpp b/src/nodes/QskBoxGradientStroker.cpp index 1f05301a..f7970507 100644 --- a/src/nodes/QskBoxGradientStroker.cpp +++ b/src/nodes/QskBoxGradientStroker.cpp @@ -183,7 +183,7 @@ namespace { public: Point() = default; - inline Point( qreal x, qreal y, qreal v ): x( x ), y( y ), v( v ) {}; + inline Point( qreal x, qreal y, qreal v ): x( x ), y( y ), v( v ) {} qreal x = 0; qreal y = 0; @@ -625,10 +625,10 @@ namespace { const auto p = vec.pointAt( it.position() ); - const qreal y1 = p.y() + ( p.x() - c1.x ) / m; - const qreal x2 = p.x() + ( p.y() - c1.y ) * m; + const qreal ly1 = p.y() + ( p.x() - c1.x ) / m; + const qreal lx2 = p.x() + ( p.y() - c1.y ) * m; - setLine( c1.x, y1, x2, c1.y, it.color(), l++ ); + setLine( c1.x, ly1, lx2, c1.y, it.color(), l++ ); it.advance(); } @@ -642,10 +642,10 @@ namespace { const auto p = vec.pointAt( it.position() ); - const qreal y1 = p.y() + ( p.x() - c2.x ) / m; - const qreal y2 = p.y() + ( p.x() - c3.x ) / m; + const qreal ly1 = p.y() + ( p.x() - c2.x ) / m; + const qreal ly2 = p.y() + ( p.x() - c3.x ) / m; - setLine( c2.x, y1, c3.x, y2, it.color(), l++ ); + setLine( c2.x, ly1, c3.x, ly2, it.color(), l++ ); it.advance(); } @@ -661,10 +661,10 @@ namespace { const auto p = vec.pointAt( it.position() ); - const qreal x1 = p.x() + ( p.y() - c2.y ) * m; - const qreal x2 = p.x() + ( p.y() - c3.y ) * m; + const qreal lx1 = p.x() + ( p.y() - c2.y ) * m; + const qreal lx2 = p.x() + ( p.y() - c3.y ) * m; - setLine( x1, c2.y, x2, c3.y, it.color(), l++ ); + setLine( lx1, c2.y, lx2, c3.y, it.color(), l++ ); it.advance(); } @@ -675,10 +675,10 @@ namespace { const auto p = vec.pointAt( it.position() ); - const qreal y1 = p.y() + ( p.x() - c4.x ) / m; - const qreal x2 = p.x() + ( p.y() - c4.y ) * m; + const qreal ly1 = p.y() + ( p.x() - c4.x ) / m; + const qreal lx2 = p.x() + ( p.y() - c4.y ) * m; - setLine( c4.x, y1, x2, c4.y, it.color(), l++ ); + setLine( c4.x, ly1, lx2, c4.y, it.color(), l++ ); it.advance(); } diff --git a/src/nodes/QskBoxNode.cpp b/src/nodes/QskBoxNode.cpp index 818f694b..cf3a3177 100644 --- a/src/nodes/QskBoxNode.cpp +++ b/src/nodes/QskBoxNode.cpp @@ -26,7 +26,7 @@ namespace }; } -void qskUpdateChildren( QSGNode* parentNode, quint8 role, QSGNode* node ) +static void qskUpdateChildren( QSGNode* parentNode, quint8 role, QSGNode* node ) { static const QVector< quint8 > roles = { ShadowRole, BoxRole, FillRole }; diff --git a/src/nodes/QskColorRamp.cpp b/src/nodes/QskColorRamp.cpp index 9e6ba805..e731858a 100644 --- a/src/nodes/QskColorRamp.cpp +++ b/src/nodes/QskColorRamp.cpp @@ -35,7 +35,7 @@ namespace setVerticalWrapMode( wrapMode ); setFiltering( QSGTexture::Linear ); - }; + } private: static inline QSGTexture::WrapMode wrapMode( QskGradient::SpreadMode spreadMode ) diff --git a/src/nodes/QskGradientMaterial.cpp b/src/nodes/QskGradientMaterial.cpp index 3f23e777..9d9e3b66 100644 --- a/src/nodes/QskGradientMaterial.cpp +++ b/src/nodes/QskGradientMaterial.cpp @@ -526,18 +526,18 @@ namespace // Angles as ratio of a rotation float start = fmod( dir.startAngle(), 360.0 ) / 360.0; - if ( start < 0.0) - start += 1.0; + if ( start < 0.0f) + start += 1.0f; float span; if ( dir.spanAngle() >= 360.0 ) { - span = 1.0; + span = 1.0f; } else if ( dir.spanAngle() <= -360.0 ) { - span = -1.0; + span = -1.0f; } else { diff --git a/src/nodes/QskRichTextRenderer.cpp b/src/nodes/QskRichTextRenderer.cpp index d9ef8f10..aba93317 100644 --- a/src/nodes/QskRichTextRenderer.cpp +++ b/src/nodes/QskRichTextRenderer.cpp @@ -83,15 +83,15 @@ namespace inline void setAlignment( Qt::Alignment alignment ) { - setHAlign( ( QQuickText::HAlignment )( int( alignment ) & 0x0f ) ); - setVAlign( ( QQuickText::VAlignment )( int( alignment ) & 0xf0 ) ); + setHAlign( static_cast< QQuickText::HAlignment >( int( alignment ) & 0x0f ) ); + setVAlign( static_cast< QQuickText::VAlignment >( int( alignment ) & 0xf0 ) ); } inline void setOptions( const QskTextOptions& options ) { // what about Qt::TextShowMnemonic ??? - setTextFormat( ( QQuickText::TextFormat ) options.format() ); - setElideMode( ( QQuickText::TextElideMode ) options.elideMode() ); + setTextFormat( static_cast< QQuickText::TextFormat >( options.format() ) ); + setElideMode( static_cast< QQuickText::TextElideMode >( options.elideMode() ) ); setMaximumLineCount( options.maximumLineCount() ); setWrapMode( static_cast< QQuickText::WrapMode >( options.wrapMode() ) ); } diff --git a/src/nodes/QskScaleRenderer.cpp b/src/nodes/QskScaleRenderer.cpp index 452bc422..2960d908 100644 --- a/src/nodes/QskScaleRenderer.cpp +++ b/src/nodes/QskScaleRenderer.cpp @@ -174,8 +174,12 @@ QSGNode* QskScaleRenderer::updateTicksNode( if( ticksNode == nullptr ) ticksNode = new QskTickmarksNode; +#if 1 + const int tickWidth = qRound( m_data->tickWidth ); +#endif + ticksNode->update( m_data->tickColor, rect, m_data->boundaries, - m_data->tickmarks, m_data->tickWidth, m_data->orientation, + m_data->tickmarks, tickWidth, m_data->orientation, m_data->alignment ); return ticksNode; diff --git a/src/nodes/QskScaleRenderer.h b/src/nodes/QskScaleRenderer.h index ee718220..e2285fdf 100644 --- a/src/nodes/QskScaleRenderer.h +++ b/src/nodes/QskScaleRenderer.h @@ -28,7 +28,7 @@ class QSK_EXPORT QskScaleRenderer { public: QskScaleRenderer(); - ~QskScaleRenderer(); + virtual ~QskScaleRenderer(); void setOrientation( Qt::Orientation ); void setAlignment( Qt::Alignment ); diff --git a/src/nodes/QskVertex.h b/src/nodes/QskVertex.h index 96bd9bf7..9b6c8350 100644 --- a/src/nodes/QskVertex.h +++ b/src/nodes/QskVertex.h @@ -73,7 +73,7 @@ namespace QskVertex { } - inline Color Color::interpolatedTo( Color colorTo, double ratio ) const noexcept + inline Color Color::interpolatedTo( Color colorTo, qreal ratio ) const noexcept { if ( ratio <= 0.0 ) return *this; @@ -81,11 +81,15 @@ namespace QskVertex if ( ratio >= 1.0 ) return colorTo; - const double t = ratio; - const double rt = 1.0 - ratio; + const auto t = ratio; + const auto rt = 1.0 - ratio; - return Color( rt * r + t * colorTo.r, rt * g + t * colorTo.g, - rt * b + t * colorTo.b, rt * a + t * colorTo.a ); + return Color( + static_cast< unsigned char >( rt * r + t * colorTo.r ), + static_cast< unsigned char >( rt * g + t * colorTo.g ), + static_cast< unsigned char >( rt * b + t * colorTo.b ), + static_cast< unsigned char >( rt * a + t * colorTo.a ) + ); } inline constexpr bool Color::operator==( const Color& other ) const noexcept