From 923affe749c7fbc8971da6b554c2d925ea89e3f2 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Wed, 4 Aug 2021 09:31:16 +0200 Subject: [PATCH] uncrustified --- examples/automotive/SkinFactory.cpp | 6 +- examples/automotive/SpeedometerDisplay.cpp | 2 +- examples/automotive/SpeedometerSkinlet.cpp | 4 +- examples/colorswitch/Theme.cpp | 2 +- .../gallery/switchbutton/SwitchButtonPage.cpp | 2 +- examples/iotdashboard/Box.h | 19 +- examples/iotdashboard/BoxWithButtons.h | 109 +++++------ examples/iotdashboard/CircularProgressBar.h | 66 +++---- examples/iotdashboard/Diagram.cpp | 20 +-- examples/iotdashboard/Diagram.h | 52 +++--- examples/iotdashboard/DiagramSkinlet.cpp | 22 +-- examples/iotdashboard/DiagramSkinlet.h | 36 ++-- examples/iotdashboard/LightIntensity.cpp | 82 ++++----- examples/iotdashboard/LightIntensity.h | 133 +++++++------- examples/iotdashboard/MainContent.cpp | 8 +- examples/iotdashboard/MainContent.h | 70 ++++---- examples/iotdashboard/MainWindow.h | 14 +- examples/iotdashboard/MenuBar.cpp | 8 +- examples/iotdashboard/MenuBar.h | 126 ++++++------- examples/iotdashboard/MyDevices.cpp | 74 ++++---- examples/iotdashboard/MyDevices.h | 4 +- examples/iotdashboard/PieChart.cpp | 3 +- examples/iotdashboard/PieChart.h | 22 +-- examples/iotdashboard/PieChartPainted.cpp | 82 ++++----- examples/iotdashboard/PieChartPainted.h | 26 +-- examples/iotdashboard/PieChartSkinlet.cpp | 3 +- examples/iotdashboard/PieChartSkinlet.h | 28 +-- examples/iotdashboard/RoundedIcon.h | 39 ++-- examples/iotdashboard/Skin.cpp | 3 +- examples/iotdashboard/Skin.h | 107 +++++------ examples/iotdashboard/TopBar.cpp | 3 +- examples/iotdashboard/TopBar.h | 116 ++++++------ examples/iotdashboard/UpAndDownButton.h | 20 +-- examples/iotdashboard/Usage.h | 34 ++-- examples/iotdashboard/UsageDiagram.cpp | 4 +- examples/iotdashboard/UsageDiagram.h | 170 +++++++++--------- examples/iotdashboard/main.cpp | 41 ++--- .../iotdashboard/nodes/DiagramDataNode.cpp | 7 +- examples/iotdashboard/nodes/DiagramDataNode.h | 36 ++-- .../nodes/DiagramSegmentsNode.cpp | 3 +- .../iotdashboard/nodes/DiagramSegmentsNode.h | 20 +-- examples/mycontrols/MySkin.cpp | 2 +- src/common/QskAspect.h | 4 +- src/controls/QskEvent.h | 2 +- src/controls/QskPageIndicatorSkinlet.cpp | 2 +- src/controls/QskQuick.cpp | 2 +- src/controls/QskQuickItem.cpp | 2 +- src/controls/QskQuickItem.h | 2 +- src/controls/QskSkinHintTableEditor.cpp | 12 +- src/controls/QskSkinHintTableEditor.h | 2 +- src/controls/QskSkinnable.cpp | 6 +- src/controls/QskStatusIndicator.cpp | 4 +- src/controls/QskSwitchButton.cpp | 4 +- src/controls/QskSwitchButtonSkinlet.cpp | 2 +- src/controls/QskTabBar.cpp | 2 +- src/controls/QskTabButton.cpp | 2 +- src/controls/QskTextInput.cpp | 12 +- src/controls/QskTextInputSkinlet.cpp | 2 +- src/inputpanel/QskInputPanelBox.cpp | 3 +- src/layouts/QskGridBox.cpp | 6 +- src/layouts/QskLinearBox.cpp | 4 +- src/layouts/QskStackBox.cpp | 4 +- src/nodes/QskScaleRenderer.h | 2 +- support/SkinnyShortcut.cpp | 2 +- 64 files changed, 863 insertions(+), 848 deletions(-) diff --git a/examples/automotive/SkinFactory.cpp b/examples/automotive/SkinFactory.cpp index 63852ec2..a53e69e6 100644 --- a/examples/automotive/SkinFactory.cpp +++ b/examples/automotive/SkinFactory.cpp @@ -35,7 +35,7 @@ namespace class Skin : public QskSkin { public: - Skin() + Skin() { declareSkinlet< Speedometer, SpeedometerSkinlet >(); @@ -49,7 +49,7 @@ namespace class Skin1 : public Skin { public: - Skin1() + Skin1() { const QColor color1( "#363636" ); // Jet const QColor color2( "#242F40" ); // Yankees blue @@ -100,7 +100,7 @@ namespace class Skin2 : public Skin { public: - Skin2() + Skin2() { const QColor color1( "#011627" ); // Maastricht blue const QColor color2( "#FF0022" ); // ruddy diff --git a/examples/automotive/SpeedometerDisplay.cpp b/examples/automotive/SpeedometerDisplay.cpp index 1cac6072..e51a4fc0 100644 --- a/examples/automotive/SpeedometerDisplay.cpp +++ b/examples/automotive/SpeedometerDisplay.cpp @@ -122,7 +122,7 @@ SpeedometerDisplay::SpeedometerDisplay( QQuickItem* parent ) setMargins( 10 ); setSpacing( 10 ); - + auto timer = new QTimer( this ); connect( timer, &QTimer::timeout, speedometer, &Speedo::updateValue ); diff --git a/examples/automotive/SpeedometerSkinlet.cpp b/examples/automotive/SpeedometerSkinlet.cpp index fb8fa81e..05b1333b 100644 --- a/examples/automotive/SpeedometerSkinlet.cpp +++ b/examples/automotive/SpeedometerSkinlet.cpp @@ -74,7 +74,7 @@ namespace auto vertexData = geometry()->vertexDataAsPoint2D(); vertexData[ 0 ].set( line.x1(), line.y1() ); vertexData[ 1 ].set( line.x2(), line.y2() ); - + geometry()->setLineWidth( width ); geometry()->markVertexDataDirty(); @@ -104,7 +104,7 @@ QRectF SpeedometerSkinlet::subControlRect( const QskSkinnable* skinnable, const auto extent = qMin( contentsRect.width(), contentsRect.height() ); r.setSize( QSizeF( extent, extent ) ); } - + r.moveCenter( contentsRect.center() ); return r; diff --git a/examples/colorswitch/Theme.cpp b/examples/colorswitch/Theme.cpp index 5d1e105f..0fae6267 100644 --- a/examples/colorswitch/Theme.cpp +++ b/examples/colorswitch/Theme.cpp @@ -37,7 +37,7 @@ namespace */ QskSkinHintTableEditor ed( &newSkin->hintTable() ); - + ed.setColor( QskListView::CellSelected, m_accent.darker( 130 ) ); ed.setBoxBorderColors( QskFocusIndicator::Panel, m_accent.darker( 150 ) ); } diff --git a/examples/gallery/switchbutton/SwitchButtonPage.cpp b/examples/gallery/switchbutton/SwitchButtonPage.cpp index 8f9c8195..169dac95 100644 --- a/examples/gallery/switchbutton/SwitchButtonPage.cpp +++ b/examples/gallery/switchbutton/SwitchButtonPage.cpp @@ -29,7 +29,7 @@ void SwitchButtonPage::populate() auto label = new QskTextLabel( "Disable the switches:", hbox1 ); label->setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed ); - + auto button0 = new QskSwitchButton( hbox1 ); auto hbox2 = new QskLinearBox( Qt::Horizontal ); diff --git a/examples/iotdashboard/Box.h b/examples/iotdashboard/Box.h index 91ff2d74..818fd615 100644 --- a/examples/iotdashboard/Box.h +++ b/examples/iotdashboard/Box.h @@ -12,18 +12,19 @@ class QskTextLabel; class Box : public QskLinearBox { - Q_OBJECT - public: - QSK_SUBCONTROLS( Panel ) + Q_OBJECT - Box( const QString& title, QQuickItem* parent ); + public: + QSK_SUBCONTROLS( Panel ) - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override; + Box( const QString& title, QQuickItem* parent ); - private: - QString m_title; - QskTextLabel* m_label; + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override; + + private: + QString m_title; + QskTextLabel* m_label; }; #endif // BOX_H diff --git a/examples/iotdashboard/BoxWithButtons.h b/examples/iotdashboard/BoxWithButtons.h index 4fbb9aa8..21ffb238 100644 --- a/examples/iotdashboard/BoxWithButtons.h +++ b/examples/iotdashboard/BoxWithButtons.h @@ -14,91 +14,92 @@ class ButtonValueLabel : public QskTextLabel { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Text ) + public: + QSK_SUBCONTROLS( Text ) - ButtonValueLabel( const QString& text, QQuickItem* parent ) : QskTextLabel( text, parent ) + ButtonValueLabel( const QString& text, QQuickItem* parent ) + : QskTextLabel( text, parent ) + { + } + + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final + { + if( subControl == QskTextLabel::Text ) { + return Text; } - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final - { - if( subControl == QskTextLabel::Text ) - { - return Text; - } - - return subControl; - } + return subControl; + } }; class TitleAndValueBox : public QskLinearBox { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Panel ) + public: + QSK_SUBCONTROLS( Panel ) - TitleAndValueBox( Qt::Orientation orientation, QQuickItem* parent ) - : QskLinearBox( orientation, parent ) + TitleAndValueBox( Qt::Orientation orientation, QQuickItem* parent ) + : QskLinearBox( orientation, parent ) + { + setPanel( true ); + } + + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final + { + if( subControl == QskLinearBox::Panel ) { - setPanel( true ); + return Panel; } - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final - { - if( subControl == QskLinearBox::Panel ) - { - return Panel; - } - - return subControl; - } + return subControl; + } }; class BoxWithButtons : public Box { - public: - QSK_SUBCONTROLS( Panel ) + public: + QSK_SUBCONTROLS( Panel ) - BoxWithButtons( const QString& title, const QString& value, bool isBright, QQuickItem* parent = nullptr ); + BoxWithButtons( const QString& title, const QString& value, bool isBright, QQuickItem* parent = nullptr ); - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override + { + if( subControl == QskBox::Panel ) { - if( subControl == QskBox::Panel ) - { - return Panel; - } - - return subControl; + return Panel; } + + return subControl; + } }; class IndoorTemperature : public BoxWithButtons { - public: - QSK_SUBCONTROLS( Panel ) + public: + QSK_SUBCONTROLS( Panel ) - IndoorTemperature( QQuickItem* parent ) - : BoxWithButtons( "Indoor Temperature", "+24", true, parent ) - { - } + IndoorTemperature( QQuickItem* parent ) + : BoxWithButtons( "Indoor Temperature", "+24", true, parent ) + { + } }; -class Humidity: public BoxWithButtons +class Humidity : public BoxWithButtons { - public: - QSK_SUBCONTROLS( Panel ) + public: + QSK_SUBCONTROLS( Panel ) - Humidity( QQuickItem* parent ) - : BoxWithButtons( "Humidity", "30%", false, parent ) - { - } + Humidity( QQuickItem* parent ) + : BoxWithButtons( "Humidity", "30%", false, parent ) + { + } }; #endif // BOXWITHBUTTONS_H diff --git a/examples/iotdashboard/CircularProgressBar.h b/examples/iotdashboard/CircularProgressBar.h index bf1b25d6..e6e3a4cb 100644 --- a/examples/iotdashboard/CircularProgressBar.h +++ b/examples/iotdashboard/CircularProgressBar.h @@ -13,47 +13,47 @@ class CircularProgressBar : public QQuickPaintedItem { - public: - CircularProgressBar( const QskGradient& gradient, int progress, QQuickItem* parent = nullptr ); + public: + CircularProgressBar( const QskGradient& gradient, int progress, QQuickItem* parent = nullptr ); - virtual void paint( QPainter* painter ) override; + virtual void paint( QPainter* painter ) override; - double width() const - { - return m_width; - } + double width() const + { + return m_width; + } - void setWidth( double width ) - { - m_width = width; - } + void setWidth( double width ) + { + m_width = width; + } - QColor backgroundColor() const - { - return m_backgroundColor; - } + QColor backgroundColor() const + { + return m_backgroundColor; + } - void setBackgroundColor( const QColor& color ) - { - m_backgroundColor = color; - } + void setBackgroundColor( const QColor& color ) + { + m_backgroundColor = color; + } - QRadialGradient ringGradient() const - { - return m_ringGradient; - } + QRadialGradient ringGradient() const + { + return m_ringGradient; + } - void setRingGradient( const QRadialGradient& gradient ) - { - m_ringGradient = gradient; - } + void setRingGradient( const QRadialGradient& gradient ) + { + m_ringGradient = gradient; + } - private: - QGradient m_gradient; - QColor m_backgroundColor; - QRadialGradient m_ringGradient; - double m_width = 20; - int m_progress; + private: + QGradient m_gradient; + QColor m_backgroundColor; + QRadialGradient m_ringGradient; + double m_width = 20; + int m_progress; }; #endif // CIRCULARPROGRESSBAR_H diff --git a/examples/iotdashboard/Diagram.cpp b/examples/iotdashboard/Diagram.cpp index cf93f7a5..60c43f70 100644 --- a/examples/iotdashboard/Diagram.cpp +++ b/examples/iotdashboard/Diagram.cpp @@ -7,16 +7,12 @@ class Diagram::PrivateData { - public: - PrivateData() - { - } - - QVector > dataPoints; - int xGridLines = -1; - qreal yMax = -1; - Qsk::Position position = Qsk::Bottom; - QVector types; + public: + QVector< QVector< QPointF > > dataPoints; + int xGridLines = -1; + qreal yMax = -1; + Qsk::Position position = Qsk::Bottom; + QVector< Types > types; }; QSK_SUBCONTROL( Diagram, Chart ) @@ -38,12 +34,12 @@ Diagram::~Diagram() { } -QVector< QVector > Diagram::dataPoints() const +QVector< QVector< QPointF > > Diagram::dataPoints() const { return m_data->dataPoints; } -void Diagram::addDataPoints( const QVector& dataPoints, const Types& types ) +void Diagram::addDataPoints( const QVector< QPointF >& dataPoints, const Types& types ) { m_data->dataPoints.append( dataPoints ); m_data->types.append( types ); diff --git a/examples/iotdashboard/Diagram.h b/examples/iotdashboard/Diagram.h index 60f32077..848a78d7 100644 --- a/examples/iotdashboard/Diagram.h +++ b/examples/iotdashboard/Diagram.h @@ -11,44 +11,44 @@ class Diagram : public QskControl { - Q_OBJECT + Q_OBJECT - using Inherited = QskControl; + using Inherited = QskControl; - public: - QSK_SUBCONTROLS( Chart, Segments, ChartLine1, ChartArea1, ChartLine2, ChartArea2, ChartLine3, ChartArea3 ) + public: + QSK_SUBCONTROLS( Chart, Segments, ChartLine1, ChartArea1, ChartLine2, ChartArea2, ChartLine3, ChartArea3 ) - enum Type - { - Line = 0x01, - Area = 0x02, - }; + enum Type + { + Line = 0x01, + Area = 0x02, + }; - Q_DECLARE_FLAGS( Types, Type ) + Q_DECLARE_FLAGS( Types, Type ) - Diagram( QQuickItem* parent = nullptr ); - ~Diagram() override; + Diagram( QQuickItem* parent = nullptr ); + ~Diagram() override; - QVector< QVector > dataPoints() const; - void addDataPoints( const QVector& dataPoints, const Types& types ); + QVector< QVector< QPointF > > dataPoints() const; + void addDataPoints( const QVector< QPointF >& dataPoints, const Types& types ); - Types typesAt( uint pos ) const; + Types typesAt( uint pos ) const; - qreal yMax() const; - void setYMax( qreal yMax ); + qreal yMax() const; + void setYMax( qreal yMax ); - int xGridLines() const; - void setXGridLines( int lines ); + int xGridLines() const; + void setXGridLines( int lines ); - Qsk::Position chartPosition() const; - void setChartPosition( Qsk::Position position ); + Qsk::Position chartPosition() const; + void setChartPosition( Qsk::Position position ); - protected: - QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override; + protected: + QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override; - private: - class PrivateData; - std::unique_ptr< PrivateData > m_data; + private: + class PrivateData; + std::unique_ptr< PrivateData > m_data; }; Q_DECLARE_OPERATORS_FOR_FLAGS( Diagram::Types ) diff --git a/examples/iotdashboard/DiagramSkinlet.cpp b/examples/iotdashboard/DiagramSkinlet.cpp index 9287bb8e..715e8cee 100644 --- a/examples/iotdashboard/DiagramSkinlet.cpp +++ b/examples/iotdashboard/DiagramSkinlet.cpp @@ -71,14 +71,14 @@ QSGNode* DiagramSkinlet::updateSubNode( switch( nodeRole ) { case ChartRole: - { - return updateChartNode( discharge, node ); - } + { + return updateChartNode( discharge, node ); + } case SeparatorRole: - { - return updateSeparatorNode( discharge, node ); - } + { + return updateSeparatorNode( discharge, node ); + } } return nullptr; @@ -95,7 +95,7 @@ QSGNode* DiagramSkinlet::updateChartNode( const Diagram* diagram, QSGNode* node const QRectF rect = diagram->subControlRect( Q::Chart ); const qreal yMax = diagram->yMax(); const Qsk::Position position = diagram->chartPosition(); - QVector types = {Diagram::Line, Diagram::Area}; + QVector< Diagram::Type > types = { Diagram::Line, Diagram::Area }; for( int i = 0; i < diagram->dataPoints().size(); ++i ) { @@ -111,7 +111,7 @@ QSGNode* DiagramSkinlet::updateChartNode( const Diagram* diagram, QSGNode* node node->appendChildNode( chartNode ); } - const QVector dataPoints = diagram->dataPoints().at( i ); + const QVector< QPointF > dataPoints = diagram->dataPoints().at( i ); int nodeIndex = 0; QskAspect::Subcontrol lineSubcontrol = lineForIndex( i ); QskAspect::Subcontrol areaSubcontrol = areaForIndex( i ); @@ -125,7 +125,7 @@ QSGNode* DiagramSkinlet::updateChartNode( const Diagram* diagram, QSGNode* node if( chartNode->childCount() > nodeIndex ) { - dataPointNode = static_cast( chartNode->childAtIndex( nodeIndex ) ); + dataPointNode = static_cast< DiagramDataNode* >( chartNode->childAtIndex( nodeIndex ) ); } else { @@ -162,7 +162,7 @@ QSGNode* DiagramSkinlet::updateSeparatorNode( const Diagram* diagram, QSGNode* n return nullptr; } - auto* separatorNode = static_cast( node ); + auto* separatorNode = static_cast< DiagramSegmentsNode* >( node ); if( separatorNode == nullptr ) { @@ -172,7 +172,7 @@ QSGNode* DiagramSkinlet::updateSeparatorNode( const Diagram* diagram, QSGNode* n using Q = Diagram; const QRectF rect = diagram->subControlRect( Q::Chart ); const QColor color = diagram->color( Q::Segments ); - const QVector< QVector > dataPoints = diagram->dataPoints(); + const QVector< QVector< QPointF > > dataPoints = diagram->dataPoints(); separatorNode->update( rect, color, dataPoints, xGridLines ); diff --git a/examples/iotdashboard/DiagramSkinlet.h b/examples/iotdashboard/DiagramSkinlet.h index d5ed612d..bfc5057e 100644 --- a/examples/iotdashboard/DiagramSkinlet.h +++ b/examples/iotdashboard/DiagramSkinlet.h @@ -12,31 +12,31 @@ class Diagram; class DiagramSkinlet : public QskSkinlet { - Q_GADGET + Q_GADGET - using Inherited = QskSkinlet; + using Inherited = QskSkinlet; - public: - enum NodeRole - { - ChartRole, - SeparatorRole, - }; + public: + enum NodeRole + { + ChartRole, + SeparatorRole, + }; - Q_INVOKABLE DiagramSkinlet( QskSkin* = nullptr ); - ~DiagramSkinlet() override; + Q_INVOKABLE DiagramSkinlet( QskSkin* = nullptr ); + ~DiagramSkinlet() override; - QRectF subControlRect( const QskSkinnable*, - const QRectF&, QskAspect::Subcontrol ) const override; + QRectF subControlRect( const QskSkinnable*, + const QRectF&, QskAspect::Subcontrol ) const override; - protected: + protected: - QSGNode* updateSubNode( const QskSkinnable*, - quint8 nodeRole, QSGNode* ) const override; + QSGNode* updateSubNode( const QskSkinnable*, + quint8 nodeRole, QSGNode* ) const override; - private: - QSGNode* updateChartNode( const Diagram*, QSGNode* ) const; - QSGNode* updateSeparatorNode( const Diagram*, QSGNode* ) const; + private: + QSGNode* updateChartNode( const Diagram*, QSGNode* ) const; + QSGNode* updateSeparatorNode( const Diagram*, QSGNode* ) const; }; #endif // DIAGRAM_SKINLET_H diff --git a/examples/iotdashboard/LightIntensity.cpp b/examples/iotdashboard/LightIntensity.cpp index f5d4bbb3..d46cad3a 100644 --- a/examples/iotdashboard/LightIntensity.cpp +++ b/examples/iotdashboard/LightIntensity.cpp @@ -34,51 +34,51 @@ namespace // ### There must be an easier way to do this class DimmerAnimator : public QskAnimator { - public: - DimmerAnimator( LightDisplay* display, LightDimmer* dimmer ) - : m_display( display ) - , m_dimmer( dimmer ) + public: + DimmerAnimator( LightDisplay* display, LightDimmer* dimmer ) + : m_display( display ) + , m_dimmer( dimmer ) + { + QQuickWindow* w = static_cast< QQuickWindow* >( qGuiApp->allWindows().at( 0 ) ); + setWindow( w ); + setDuration( 500 ); + setEasingCurve( QEasingCurve::Linear ); + setAutoRepeat( false ); + } + + void setup() override + { + m_backgroundColor = m_display->color( LightDisplay::Panel ); + m_ringGradient = m_dimmer->ringGradient(); + } + + void advance( qreal value ) override + { + const QColor c = m_backgroundColor; + const QColor c2 = invertedColor( c ); + const QColor newColor = QskRgb::interpolated( c2, c, value ); + m_dimmer->setBackgroundColor( newColor ); + + QRadialGradient gradient = m_ringGradient; + QRadialGradient newGradient = gradient; + + for( const QGradientStop& stop : gradient.stops() ) { - QQuickWindow* w = static_cast( qGuiApp->allWindows().at( 0 ) ); - setWindow( w ); - setDuration( 500 ); - setEasingCurve( QEasingCurve::Linear ); - setAutoRepeat( false ); + QColor c = stop.second; + QColor c2 = invertedColor( c ); + const QColor newColor = QskRgb::interpolated( c, c2, value ); + newGradient.setColorAt( stop.first, newColor ); } - void setup() override - { - m_backgroundColor = m_display->color( LightDisplay::Panel ); - m_ringGradient = m_dimmer->ringGradient(); - } + m_dimmer->setRingGradient( newGradient ); + m_dimmer->update(); + } - void advance( qreal value ) override - { - const QColor c = m_backgroundColor; - const QColor c2 = invertedColor( c ); - const QColor newColor = QskRgb::interpolated( c2, c, value ); - m_dimmer->setBackgroundColor( newColor ); - - QRadialGradient gradient = m_ringGradient; - QRadialGradient newGradient = gradient; - - for( const QGradientStop& stop : gradient.stops() ) - { - QColor c = stop.second; - QColor c2 = invertedColor( c ); - const QColor newColor = QskRgb::interpolated( c, c2, value ); - newGradient.setColorAt( stop.first, newColor ); - } - - m_dimmer->setRingGradient( newGradient ); - m_dimmer->update(); - } - - private: - QColor m_backgroundColor; - QRadialGradient m_ringGradient; - LightDisplay* m_display; - LightDimmer* m_dimmer; + private: + QColor m_backgroundColor; + QRadialGradient m_ringGradient; + LightDisplay* m_display; + LightDimmer* m_dimmer; }; LightDimmer::LightDimmer( const QskGradient& coldGradient, const QskGradient& warmGradient, QQuickItem* parent ) diff --git a/examples/iotdashboard/LightIntensity.h b/examples/iotdashboard/LightIntensity.h index d50e1469..e4cd7e2f 100644 --- a/examples/iotdashboard/LightIntensity.h +++ b/examples/iotdashboard/LightIntensity.h @@ -18,103 +18,104 @@ class QskTextLabel; class LightIntensityValueLabel : public QskTextLabel { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Text ) + public: + QSK_SUBCONTROLS( Text ) - LightIntensityValueLabel( const QString& text, QQuickItem* parent ) : QskTextLabel( text, parent ) + LightIntensityValueLabel( const QString& text, QQuickItem* parent ) + : QskTextLabel( text, parent ) + { + } + + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final + { + if( subControl == QskTextLabel::Text ) { + return Text; } - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final - { - if( subControl == QskTextLabel::Text ) - { - return Text; - } - - return subControl; - } + return subControl; + } }; -class LightDimmer: public QQuickPaintedItem +class LightDimmer : public QQuickPaintedItem { - Q_OBJECT + Q_OBJECT - public: - LightDimmer( const QskGradient& coldGradient, const QskGradient& warmGradient, QQuickItem* parent ); + public: + LightDimmer( const QskGradient& coldGradient, const QskGradient& warmGradient, QQuickItem* parent ); - double thickness() const - { - return m_thickness; - } + double thickness() const + { + return m_thickness; + } - void setThickness( double thickness ) - { - m_thickness = thickness; - } + void setThickness( double thickness ) + { + m_thickness = thickness; + } - QColor backgroundColor() const - { - return m_backgroundColor; - } + QColor backgroundColor() const + { + return m_backgroundColor; + } - void setBackgroundColor( const QColor& color ) - { - m_backgroundColor = color; - } + void setBackgroundColor( const QColor& color ) + { + m_backgroundColor = color; + } - QRadialGradient ringGradient() const - { - return m_ringGradient; - } + QRadialGradient ringGradient() const + { + return m_ringGradient; + } - void setRingGradient( const QRadialGradient& gradient ) - { - m_ringGradient = gradient; - } + void setRingGradient( const QRadialGradient& gradient ) + { + m_ringGradient = gradient; + } - private: - double m_thickness = 17.57; - QColor m_backgroundColor; - QRadialGradient m_ringGradient; - QskGradient m_coldGradient; - QskGradient m_warmGradient; + private: + double m_thickness = 17.57; + QColor m_backgroundColor; + QRadialGradient m_ringGradient; + QskGradient m_coldGradient; + QskGradient m_warmGradient; - virtual void paint( QPainter* painter ) override; + virtual void paint( QPainter* painter ) override; }; class LightDisplay : public QskControl { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Panel, ColdPart, WarmPart ) + public: + QSK_SUBCONTROLS( Panel, ColdPart, WarmPart ) - LightDisplay( QQuickItem* parent ); + LightDisplay( QQuickItem* parent ); - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final; + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final; - protected: - void updateLayout() override; + protected: + void updateLayout() override; - private: - QskTextLabel* m_leftLabel; - LightIntensityValueLabel* m_centreLabel; - QskTextLabel* m_rightLabel; - LightDimmer* m_dimmer; - DimmerAnimator* m_animator; + private: + QskTextLabel* m_leftLabel; + LightIntensityValueLabel* m_centreLabel; + QskTextLabel* m_rightLabel; + LightDimmer* m_dimmer; + DimmerAnimator* m_animator; }; class LightIntensity : public Box { - Q_OBJECT + Q_OBJECT - public: - LightIntensity( QQuickItem* parent ); + public: + LightIntensity( QQuickItem* parent ); }; #endif // LIGHTINTENSITY_H diff --git a/examples/iotdashboard/MainContent.cpp b/examples/iotdashboard/MainContent.cpp index 99b6ef71..edd2876a 100644 --- a/examples/iotdashboard/MainContent.cpp +++ b/examples/iotdashboard/MainContent.cpp @@ -32,7 +32,8 @@ QSK_SUBCONTROL( ShadowPositioner, Panel ) QSK_SUBCONTROL( MainContent, Panel ) QSK_SUBCONTROL( MainContentGridBox, Panel ) -ShadowPositioner::ShadowPositioner( QQuickItem* parent ) : QskControl( parent ) +ShadowPositioner::ShadowPositioner( QQuickItem* parent ) + : QskControl( parent ) { setAutoLayoutChildren( true ); } @@ -68,7 +69,7 @@ void ShadowPositioner::setGridBox( QskGridBox* gridBox ) void ShadowPositioner::updateLayout() { - auto* mainContent = static_cast( parentItem() ); + auto* mainContent = static_cast< QskLinearBox* >( parentItem() ); QTimer::singleShot( 0, this, [this, mainContent]() { @@ -81,7 +82,8 @@ void ShadowPositioner::updateLayout() } ); } -MainContent::MainContent( QQuickItem* parent ) : QskLinearBox( Qt::Vertical, parent ) +MainContent::MainContent( QQuickItem* parent ) + : QskLinearBox( Qt::Vertical, parent ) { setAutoAddChildren( false ); setSizePolicy( QskSizePolicy::Expanding, QskSizePolicy::Expanding ); diff --git a/examples/iotdashboard/MainContent.h b/examples/iotdashboard/MainContent.h index 3b1e55dd..da032aff 100644 --- a/examples/iotdashboard/MainContent.h +++ b/examples/iotdashboard/MainContent.h @@ -13,63 +13,63 @@ class ShadowedRectangle; class ShadowPositioner : public QskControl { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Panel ) + public: + QSK_SUBCONTROLS( Panel ) - ShadowPositioner( QQuickItem* parent ); + ShadowPositioner( QQuickItem* parent ); - void updateLayout() override; - void setGridBox( QskGridBox* gridBox ); + void updateLayout() override; + void setGridBox( QskGridBox* gridBox ); - private: - QskGridBox* m_gridBox; - QVector m_rectangles; + private: + QskGridBox* m_gridBox; + QVector< ShadowedRectangle* > m_rectangles; }; class MainContentGridBox : public QskGridBox { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Panel ) + public: + QSK_SUBCONTROLS( Panel ) - MainContentGridBox( QQuickItem* parent = nullptr ) - : QskGridBox( parent ) + MainContentGridBox( QQuickItem* parent = nullptr ) + : QskGridBox( parent ) + { + } + + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final + { + if( subControl == QskGridBox::Panel ) { + return Panel; } - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final - { - if( subControl == QskGridBox::Panel ) - { - return Panel; - } - - return subControl; - } + return subControl; + } }; class MainContent : public QskLinearBox { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Panel ) + public: + QSK_SUBCONTROLS( Panel ) - MainContent( QQuickItem* parent ); + MainContent( QQuickItem* parent ); - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final; + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final; - protected: - void geometryChangeEvent( QskGeometryChangeEvent* ) override; + protected: + void geometryChangeEvent( QskGeometryChangeEvent* ) override; - private: - QList< QskLinearBox* > m_columns; - ShadowPositioner* m_shadowPositioner; + private: + QList< QskLinearBox* > m_columns; + ShadowPositioner* m_shadowPositioner; }; #endif // MAINCONTENT_H diff --git a/examples/iotdashboard/MainWindow.h b/examples/iotdashboard/MainWindow.h index faba9d82..92428336 100644 --- a/examples/iotdashboard/MainWindow.h +++ b/examples/iotdashboard/MainWindow.h @@ -14,15 +14,15 @@ class QskLinearBox; class MainWindow : public QskWindow { - Q_OBJECT + Q_OBJECT - public: - MainWindow(); + public: + MainWindow(); - private: - QskLinearBox* m_mainLayout; - MenuBar* m_menuBar; - MainContent* m_mainContent; + private: + QskLinearBox* m_mainLayout; + MenuBar* m_menuBar; + MainContent* m_mainContent; }; #endif // MAINWINDOW_H diff --git a/examples/iotdashboard/MenuBar.cpp b/examples/iotdashboard/MenuBar.cpp index 24c8f2e2..88b7af8b 100644 --- a/examples/iotdashboard/MenuBar.cpp +++ b/examples/iotdashboard/MenuBar.cpp @@ -21,8 +21,9 @@ QSK_SUBCONTROL( MenuBar, Panel ) QSK_STATE( MenuItem, Active, ( QskAspect::FirstUserState << 1 ) ) -MenuItem::MenuItem( const QString& name, QQuickItem* parent ) : QskLinearBox( Qt::Horizontal, parent ), - m_name( name ) +MenuItem::MenuItem( const QString& name, QQuickItem* parent ) + : QskLinearBox( Qt::Horizontal, parent ) + , m_name( name ) { setAutoLayoutChildren( true ); setAutoAddChildren( true ); @@ -53,7 +54,8 @@ QskAspect::Subcontrol MenuItem::effectiveSubcontrol( QskAspect::Subcontrol subCo } -MenuBar::MenuBar( QQuickItem* parent ) : QskLinearBox( Qt::Vertical, parent ) +MenuBar::MenuBar( QQuickItem* parent ) + : QskLinearBox( Qt::Vertical, parent ) { setPanel( true ); setSizePolicy( QskSizePolicy::Minimum, QskSizePolicy::Preferred ); diff --git a/examples/iotdashboard/MenuBar.h b/examples/iotdashboard/MenuBar.h index 02d7e931..03f86bc3 100644 --- a/examples/iotdashboard/MenuBar.h +++ b/examples/iotdashboard/MenuBar.h @@ -12,108 +12,108 @@ class MenuBarTopLabel final : public QskGraphicLabel { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Graphic ) + public: + QSK_SUBCONTROLS( Graphic ) - MenuBarTopLabel( const QskGraphic& graphic, QQuickItem* parent = nullptr ) - : QskGraphicLabel( graphic, parent ) + MenuBarTopLabel( const QskGraphic& graphic, QQuickItem* parent = nullptr ) + : QskGraphicLabel( graphic, parent ) + { + } + + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override + { + if( subControl == QskGraphicLabel::Graphic ) { + return Graphic; } - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override - { - if( subControl == QskGraphicLabel::Graphic ) - { - return Graphic; - } - - return subControl; - } + return subControl; + } }; class MenuBarGraphicLabel final : public QskGraphicLabel { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Graphic ) + public: + QSK_SUBCONTROLS( Graphic ) - MenuBarGraphicLabel( const QskGraphic& graphic, QQuickItem* parent = nullptr ) - : QskGraphicLabel( graphic, parent ) + MenuBarGraphicLabel( const QskGraphic& graphic, QQuickItem* parent = nullptr ) + : QskGraphicLabel( graphic, parent ) + { + } + + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override + { + if( subControl == QskGraphicLabel::Graphic ) { + return Graphic; } - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override - { - if( subControl == QskGraphicLabel::Graphic ) - { - return Graphic; - } - - return subControl; - } + return subControl; + } }; class MenuBarLabel final : public QskTextLabel { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Text ) + public: + QSK_SUBCONTROLS( Text ) - MenuBarLabel( const QString& text, QQuickItem* parent = nullptr ) - : QskTextLabel( text, parent ) + MenuBarLabel( const QString& text, QQuickItem* parent = nullptr ) + : QskTextLabel( text, parent ) + { + } + + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override + { + if( subControl == QskTextLabel::Text ) { + return Text; } - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override - { - if( subControl == QskTextLabel::Text ) - { - return Text; - } - - return subControl; - } + return subControl; + } }; class MenuItem final : public QskLinearBox { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Panel ) - QSK_STATES( Active ) + public: + QSK_SUBCONTROLS( Panel ) + QSK_STATES( Active ) - MenuItem( const QString& name, QQuickItem* parent ); + MenuItem( const QString& name, QQuickItem* parent ); - QskAspect::Subcontrol effectiveSubcontrol( QskAspect::Subcontrol ) const override; + QskAspect::Subcontrol effectiveSubcontrol( QskAspect::Subcontrol ) const override; - private: - QString m_name; + private: + QString m_name; }; class MenuBar final : public QskLinearBox { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Panel ) + public: + QSK_SUBCONTROLS( Panel ) - MenuBar( QQuickItem* parent ); + MenuBar( QQuickItem* parent ); - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol ) const override; + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol ) const override; - private: - QList< QString > m_entryStrings; - QList< MenuItem* > m_entries; - uint m_activeEntry = 0; + private: + QList< QString > m_entryStrings; + QList< MenuItem* > m_entries; + uint m_activeEntry = 0; }; #endif // MENUBAR_H diff --git a/examples/iotdashboard/MyDevices.cpp b/examples/iotdashboard/MyDevices.cpp index 6264820d..4c6bb938 100644 --- a/examples/iotdashboard/MyDevices.cpp +++ b/examples/iotdashboard/MyDevices.cpp @@ -18,49 +18,49 @@ namespace { class Device : public QskLinearBox { - public: - Device( const QString& name, bool isBright, QQuickItem* parent ) - : QskLinearBox( Qt::Vertical, parent ) - , m_name( name ) - { - setDefaultAlignment( Qt::AlignCenter ); - setAutoAddChildren( false ); + public: + Device( const QString& name, bool isBright, QQuickItem* parent ) + : QskLinearBox( Qt::Vertical, parent ) + , m_name( name ) + { + setDefaultAlignment( Qt::AlignCenter ); + setAutoAddChildren( false ); - m_icon = new RoundedIcon( QString(), isBright, true, this ); - m_icon->setSkinState( m_icon->skinState() | RoundedIcon::Small ); - m_icon->setOpacity( 0.15 ); - addItem( m_icon ); + m_icon = new RoundedIcon( QString(), isBright, true, this ); + m_icon->setSkinState( m_icon->skinState() | RoundedIcon::Small ); + m_icon->setOpacity( 0.15 ); + addItem( m_icon ); - auto* textLabel = new QskTextLabel( name, this ); - textLabel->setFontRole( QskSkin::TinyFont ); - textLabel->setAlignment( Qt::AlignHCenter ); - addItem( textLabel ); + auto* textLabel = new QskTextLabel( name, this ); + textLabel->setFontRole( QskSkin::TinyFont ); + textLabel->setAlignment( Qt::AlignHCenter ); + addItem( textLabel ); - auto fileName = name.toLower(); - fileName.replace( ' ', '-' ); - fileName = ":/images/" + fileName + ".png"; - QImage image( fileName ); - auto graphic = QskGraphic::fromImage( image ); - m_graphicLabel = new QskGraphicLabel( graphic, this ); - } + auto fileName = name.toLower(); + fileName.replace( ' ', '-' ); + fileName = ":/images/" + fileName + ".png"; + QImage image( fileName ); + auto graphic = QskGraphic::fromImage( image ); + m_graphicLabel = new QskGraphicLabel( graphic, this ); + } - protected: - void updateLayout() override - { - QskLinearBox::updateLayout(); + protected: + void updateLayout() override + { + QskLinearBox::updateLayout(); - // We cannot use the icon from RoundedIcon here because - // it would inherit the transparency - const qreal size = metric( RoundedIcon::Icon | QskAspect::Size ); - m_graphicLabel->setSize( {size, size} ); - m_graphicLabel->setPosition( { m_icon->position().x() + ( m_icon->width() - m_graphicLabel->width() ) / 2, - ( m_icon->position().y() + m_icon->height() - m_graphicLabel->height() ) / 2 } ); - } + // We cannot use the icon from RoundedIcon here because + // it would inherit the transparency + const qreal size = metric( RoundedIcon::Icon | QskAspect::Size ); + m_graphicLabel->setSize( {size, size} ); + m_graphicLabel->setPosition( { m_icon->position().x() + ( m_icon->width() - m_graphicLabel->width() ) / 2, + ( m_icon->position().y() + m_icon->height() - m_graphicLabel->height() ) / 2 } ); + } - private: - QString m_name; - RoundedIcon* m_icon; - QskGraphicLabel* m_graphicLabel; + private: + QString m_name; + RoundedIcon* m_icon; + QskGraphicLabel* m_graphicLabel; }; } diff --git a/examples/iotdashboard/MyDevices.h b/examples/iotdashboard/MyDevices.h index 53787029..361bd7fd 100644 --- a/examples/iotdashboard/MyDevices.h +++ b/examples/iotdashboard/MyDevices.h @@ -10,8 +10,8 @@ class MyDevices : public Box { - public: - MyDevices( QQuickItem* parent ); + public: + MyDevices( QQuickItem* parent ); }; #endif // MYDEVICES_H diff --git a/examples/iotdashboard/PieChart.cpp b/examples/iotdashboard/PieChart.cpp index 386c9dfa..4a8bf227 100644 --- a/examples/iotdashboard/PieChart.cpp +++ b/examples/iotdashboard/PieChart.cpp @@ -8,7 +8,8 @@ QSK_SUBCONTROL( PieChart, Panel ) QSK_SUBCONTROL( PieChart, Labels ) -PieChart::PieChart( QQuickItem* parent ) : QskControl( parent ) +PieChart::PieChart( QQuickItem* parent ) + : QskControl( parent ) { } diff --git a/examples/iotdashboard/PieChart.h b/examples/iotdashboard/PieChart.h index eca44c35..dd76994c 100644 --- a/examples/iotdashboard/PieChart.h +++ b/examples/iotdashboard/PieChart.h @@ -10,22 +10,22 @@ class PieChart : public QskControl { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Panel, Labels ) + public: + QSK_SUBCONTROLS( Panel, Labels ) - PieChart( QQuickItem* parent = nullptr ); + PieChart( QQuickItem* parent = nullptr ); - QVector< float > angles() const; - void setAngles( const QVector< float >& angles ); + QVector< float > angles() const; + void setAngles( const QVector< float >& angles ); - QVector< QString > labels() const; - void setLabels( const QVector< QString >& labels ); + QVector< QString > labels() const; + void setLabels( const QVector< QString >& labels ); - private: - QVector< float > m_angles; - QVector< QString > m_labels; + private: + QVector< float > m_angles; + QVector< QString > m_labels; }; #endif // PIECHART_H diff --git a/examples/iotdashboard/PieChartPainted.cpp b/examples/iotdashboard/PieChartPainted.cpp index c71bf023..150600a6 100644 --- a/examples/iotdashboard/PieChartPainted.cpp +++ b/examples/iotdashboard/PieChartPainted.cpp @@ -32,51 +32,51 @@ namespace // ### There must be an easier way to do this class ProgressBarAnimator : public QskAnimator { - public: - ProgressBarAnimator( PieChartPainted* pieChart, CircularProgressBar* progressBar ) - : m_pieChart( pieChart ) - , m_progressBar( progressBar ) + public: + ProgressBarAnimator( PieChartPainted* pieChart, CircularProgressBar* progressBar ) + : m_pieChart( pieChart ) + , m_progressBar( progressBar ) + { + QQuickWindow* w = static_cast< QQuickWindow* >( qGuiApp->allWindows().at( 0 ) ); + setWindow( w ); + setDuration( 500 ); + setEasingCurve( QEasingCurve::Linear ); + setAutoRepeat( false ); + } + + void setup() override + { + m_backgroundColor = m_pieChart->color( PieChartPainted::Panel ); + m_ringGradient = m_progressBar->ringGradient(); + } + + void advance( qreal value ) override + { + const QColor c = m_backgroundColor; + const QColor c2 = invertedColor( c ); + const QColor newColor = QskRgb::interpolated( c2, c, value ); + m_progressBar->setBackgroundColor( newColor ); + + QRadialGradient gradient = m_ringGradient; + QRadialGradient newGradient = gradient; + + for( const QGradientStop& stop : gradient.stops() ) { - QQuickWindow* w = static_cast( qGuiApp->allWindows().at( 0 ) ); - setWindow( w ); - setDuration( 500 ); - setEasingCurve( QEasingCurve::Linear ); - setAutoRepeat( false ); + QColor c = stop.second; + QColor c2 = invertedColor( c ); + const QColor newColor = QskRgb::interpolated( c, c2, value ); + newGradient.setColorAt( stop.first, newColor ); } - void setup() override - { - m_backgroundColor = m_pieChart->color( PieChartPainted::Panel ); - m_ringGradient = m_progressBar->ringGradient(); - } + m_progressBar->setRingGradient( newGradient ); + m_progressBar->update(); + } - void advance( qreal value ) override - { - const QColor c = m_backgroundColor; - const QColor c2 = invertedColor( c ); - const QColor newColor = QskRgb::interpolated( c2, c, value ); - m_progressBar->setBackgroundColor( newColor ); - - QRadialGradient gradient = m_ringGradient; - QRadialGradient newGradient = gradient; - - for( const QGradientStop& stop : gradient.stops() ) - { - QColor c = stop.second; - QColor c2 = invertedColor( c ); - const QColor newColor = QskRgb::interpolated( c, c2, value ); - newGradient.setColorAt( stop.first, newColor ); - } - - m_progressBar->setRingGradient( newGradient ); - m_progressBar->update(); - } - - private: - QColor m_backgroundColor; - QRadialGradient m_ringGradient; - PieChartPainted* m_pieChart; - CircularProgressBar* m_progressBar; + private: + QColor m_backgroundColor; + QRadialGradient m_ringGradient; + PieChartPainted* m_pieChart; + CircularProgressBar* m_progressBar; }; PieChartPainted::PieChartPainted( const QColor& color, const QskGradient& gradient, int progress, int /*value*/, QQuickItem* parent ) diff --git a/examples/iotdashboard/PieChartPainted.h b/examples/iotdashboard/PieChartPainted.h index 4083a5b1..98872b56 100644 --- a/examples/iotdashboard/PieChartPainted.h +++ b/examples/iotdashboard/PieChartPainted.h @@ -17,23 +17,23 @@ class QQuickPaintedItem; class PieChartPainted : public QskControl { - public: - QSK_SUBCONTROLS( Panel ) + public: + QSK_SUBCONTROLS( Panel ) - PieChartPainted( const QColor& color, const QskGradient& gradient, int progress, int value, QQuickItem* parent = nullptr ); + PieChartPainted( const QColor& color, const QskGradient& gradient, int progress, int value, QQuickItem* parent = nullptr ); - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final; + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final; - virtual QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override; - void updateLayout() override; + virtual QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override; + void updateLayout() override; - private: - QColor m_color; - QskGradient m_gradient; - CircularProgressBar* m_progressBar; - QskTextLabel* m_progressLabel; - ProgressBarAnimator* m_animator; + private: + QColor m_color; + QskGradient m_gradient; + CircularProgressBar* m_progressBar; + QskTextLabel* m_progressLabel; + ProgressBarAnimator* m_animator; }; #endif // PIECHARTPAINTED_H diff --git a/examples/iotdashboard/PieChartSkinlet.cpp b/examples/iotdashboard/PieChartSkinlet.cpp index e7916098..7dfbde45 100644 --- a/examples/iotdashboard/PieChartSkinlet.cpp +++ b/examples/iotdashboard/PieChartSkinlet.cpp @@ -11,7 +11,8 @@ #include #include -PieChartSkinlet::PieChartSkinlet( QskSkin* skin ) : QskSkinlet( skin ) +PieChartSkinlet::PieChartSkinlet( QskSkin* skin ) + : QskSkinlet( skin ) { setNodeRoles( { PanelRole, LabelsRole } ); } diff --git a/examples/iotdashboard/PieChartSkinlet.h b/examples/iotdashboard/PieChartSkinlet.h index bca022fc..c0742742 100644 --- a/examples/iotdashboard/PieChartSkinlet.h +++ b/examples/iotdashboard/PieChartSkinlet.h @@ -12,25 +12,25 @@ class PieChart; class PieChartSkinlet : public QskSkinlet { - Q_GADGET + Q_GADGET - public: - enum NodeRole - { - PanelRole, - LabelsRole - }; + public: + enum NodeRole + { + PanelRole, + LabelsRole + }; - Q_INVOKABLE PieChartSkinlet( QskSkin* skin = nullptr ); + Q_INVOKABLE PieChartSkinlet( QskSkin* skin = nullptr ); - QRectF subControlRect( const QskSkinnable*, const QRectF&, QskAspect::Subcontrol ) const override; + QRectF subControlRect( const QskSkinnable*, const QRectF&, QskAspect::Subcontrol ) const override; - protected: - virtual QSGNode* updateSubNode( const QskSkinnable*, quint8 nodeRole, QSGNode* node ) const override; + protected: + virtual QSGNode* updateSubNode( const QskSkinnable*, quint8 nodeRole, QSGNode* node ) const override; - private: - QSGNode* updatePanelNode( const PieChart*, QSGNode* ) const; - QSGNode* updateLabelsNode( const PieChart*, QSGNode* ) const; + private: + QSGNode* updatePanelNode( const PieChart*, QSGNode* ) const; + QSGNode* updateLabelsNode( const PieChart*, QSGNode* ) const; }; #endif // PIECHART_SKINLET_H diff --git a/examples/iotdashboard/RoundedIcon.h b/examples/iotdashboard/RoundedIcon.h index 5a9201a0..303ff394 100644 --- a/examples/iotdashboard/RoundedIcon.h +++ b/examples/iotdashboard/RoundedIcon.h @@ -13,32 +13,33 @@ class QskGraphicLabel; class RoundedIcon : public QskBox { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Panel, Icon ) - QSK_STATES( Bright, Small ) // to differentiate between orange and purple and small vs. big + public: + QSK_SUBCONTROLS( Panel, Icon ) + QSK_STATES( Bright, Small ) // to differentiate between orange and purple and small vs. big - RoundedIcon( const QString& iconName, bool isBright, bool isSmall, QQuickItem* parent = nullptr ); + RoundedIcon( const QString& iconName, bool isBright, bool isSmall, + QQuickItem* parent = nullptr ); - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override + { + if( subControl == QskBox::Panel ) { - if( subControl == QskBox::Panel ) - { - return Panel; - } - - return subControl; + return Panel; } - protected: - void updateLayout() override; - virtual QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override; + return subControl; + } - private: - QString m_iconName; - QskGraphicLabel* m_graphicLabel = nullptr; + protected: + void updateLayout() override; + virtual QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override; + + private: + QString m_iconName; + QskGraphicLabel* m_graphicLabel = nullptr; }; #endif // ROUNDEDICON_H diff --git a/examples/iotdashboard/Skin.cpp b/examples/iotdashboard/Skin.cpp index 78e648e0..f2a14d01 100644 --- a/examples/iotdashboard/Skin.cpp +++ b/examples/iotdashboard/Skin.cpp @@ -43,7 +43,8 @@ namespace } -Skin::Skin( const Palette& palette, QObject* parent ) : QskSkin( parent ) +Skin::Skin( const Palette& palette, QObject* parent ) + : QskSkin( parent ) { declareSkinlet< Diagram, DiagramSkinlet >(); diff --git a/examples/iotdashboard/Skin.h b/examples/iotdashboard/Skin.h index aa323c55..e632a891 100644 --- a/examples/iotdashboard/Skin.h +++ b/examples/iotdashboard/Skin.h @@ -11,71 +11,72 @@ class Skin : public QskSkin { - public: - class Palette + public: + class Palette + { + public: + Palette( const QskGradient& menuBar, const QskGradient& mainContent, + const QskGradient& box, const QColor& lightDisplay, const QColor& pieChart, + const QskGradient& roundButton, const QColor& weekdayBox, + const QColor& text, const QColor& shadow ) + : menuBar( menuBar ) + , mainContent( mainContent ) + , box( box ) + , lightDisplay( lightDisplay ) + , pieChart( pieChart ) + , roundButton( roundButton ) + , weekdayBox( weekdayBox ) + , text( text ) + , shadow( shadow ) { - public: - Palette( const QskGradient& menuBar, const QskGradient& mainContent, const QskGradient& box, - const QColor& lightDisplay, const QColor& pieChart, const QskGradient& roundButton, - const QColor& weekdayBox, const QColor& text, const QColor& shadow ) - : menuBar( menuBar ) - , mainContent( mainContent ) - , box( box ) - , lightDisplay( lightDisplay ) - , pieChart( pieChart ) - , roundButton( roundButton ) - , weekdayBox( weekdayBox ) - , text( text ) - , shadow( shadow ) - { - } - QskGradient menuBar; - QskGradient mainContent; - QskGradient box; - QColor lightDisplay; - QColor pieChart; - QskGradient roundButton; - QColor weekdayBox; - QColor text; - QColor shadow; - }; + } + QskGradient menuBar; + QskGradient mainContent; + QskGradient box; + QColor lightDisplay; + QColor pieChart; + QskGradient roundButton; + QColor weekdayBox; + QColor text; + QColor shadow; + }; - Skin( const Palette& palette, QObject* parent = nullptr ); - virtual ~Skin(); + Skin( const Palette& palette, QObject* parent = nullptr ); + ~Skin() override; - enum SkinFontRole - { - TitleFont = QskSkin::HugeFont + 1, - }; + enum SkinFontRole + { + TitleFont = QskSkin::HugeFont + 1, + }; - private: - void initHints( const Palette& palette ); + private: + void initHints( const Palette& palette ); }; class DaytimeSkin : public Skin { - public: - DaytimeSkin( QObject* parent = nullptr ) - : Skin( - Skin::Palette( {"#6D7BFB"}, {"#fbfbfb"}, {"#ffffff"}, - "#ffffff", "#ffffff", {"#f7f7f7"}, - {"#f4f4f4"}, Qt::black, Qt::black ) - , parent ) - { - } + public: + DaytimeSkin( QObject* parent = nullptr ) + : Skin( + Skin::Palette( {"#6D7BFB"}, {"#fbfbfb"}, {"#ffffff"}, + "#ffffff", "#ffffff", {"#f7f7f7"}, + {"#f4f4f4"}, Qt::black, Qt::black ) + , parent ) + { + } }; class NighttimeSkin : public Skin { - public: - NighttimeSkin( QObject* parent = nullptr ) - : Skin( - Skin::Palette( {"#2937A7"}, {"#040404"}, {"#000000"}, - "#000000", "#000000", {"#0a0a0a"}, - {"#0c0c0c"}, Qt::white, Qt::white ) - , parent ) - { - } + public: + NighttimeSkin( QObject* parent = nullptr ) + : Skin( + Skin::Palette( {"#2937A7"}, {"#040404"}, {"#000000"}, + "#000000", "#000000", {"#0a0a0a"}, + {"#0c0c0c"}, Qt::white, Qt::white ) + , parent ) + { + } }; #endif // SKIN_H diff --git a/examples/iotdashboard/TopBar.cpp b/examples/iotdashboard/TopBar.cpp index 5a8917a5..7e432cdb 100644 --- a/examples/iotdashboard/TopBar.cpp +++ b/examples/iotdashboard/TopBar.cpp @@ -74,7 +74,8 @@ TopBarItem::TopBarItem( int index, const QString& name, const QskGradient& gradi } -TopBar::TopBar( QQuickItem* parent ) : QskLinearBox( Qt::Horizontal, parent ) +TopBar::TopBar( QQuickItem* parent ) + : QskLinearBox( Qt::Horizontal, parent ) { setPanel( true ); setAutoLayoutChildren( true ); diff --git a/examples/iotdashboard/TopBar.h b/examples/iotdashboard/TopBar.h index 5dbe7fe9..1a55b32f 100644 --- a/examples/iotdashboard/TopBar.h +++ b/examples/iotdashboard/TopBar.h @@ -13,98 +13,98 @@ class TimeTitleLabel : public QskTextLabel { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Text ) + public: + QSK_SUBCONTROLS( Text ) - TimeTitleLabel( const QString& text, QQuickItem* parent = nullptr ) - : QskTextLabel( text, parent ) + TimeTitleLabel( const QString& text, QQuickItem* parent = nullptr ) + : QskTextLabel( text, parent ) + { + } + + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final + { + if( subControl == QskTextLabel::Text ) { + return Text; } - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final - { - if( subControl == QskTextLabel::Text ) - { - return Text; - } - - return subControl; - } + return subControl; + } }; class TimeLabel : public QskTextLabel { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Text ) + public: + QSK_SUBCONTROLS( Text ) - TimeLabel( const QString& text, QQuickItem* parent = nullptr ) - : QskTextLabel( text, parent ) + TimeLabel( const QString& text, QQuickItem* parent = nullptr ) + : QskTextLabel( text, parent ) + { + } + + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final + { + if( subControl == QskTextLabel::Text ) { + return Text; } - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final - { - if( subControl == QskTextLabel::Text ) - { - return Text; - } - - return subControl; - } + return subControl; + } }; class TopBarItem : public QskLinearBox { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Item1, Item2, Item3, Item4 ) + public: + QSK_SUBCONTROLS( Item1, Item2, Item3, Item4 ) - TopBarItem( int index, const QString& name, const QskGradient& gradient, int progress, int value, QQuickItem* parent ); + TopBarItem( int index, const QString& name, const QskGradient& gradient, int progress, int value, QQuickItem* parent ); - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final + { + if( subControl == QskLinearBox::Panel ) { - if( subControl == QskLinearBox::Panel ) - { - return Panel; - } - - return subControl; + return Panel; } - private: - QString m_name; + return subControl; + } + + private: + QString m_name; }; class TopBar : public QskLinearBox { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Panel ) + public: + QSK_SUBCONTROLS( Panel ) - TopBar( QQuickItem* parent ); + TopBar( QQuickItem* parent ); - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final + { + if( subControl == QskLinearBox::Panel ) { - if( subControl == QskLinearBox::Panel ) - { - return Panel; - } - - return subControl; + return Panel; } - private: - QList< TopBarItem* > m_entries; + return subControl; + } + + private: + QList< TopBarItem* > m_entries; }; #endif diff --git a/examples/iotdashboard/UpAndDownButton.h b/examples/iotdashboard/UpAndDownButton.h index d2fb1362..5a4051d3 100644 --- a/examples/iotdashboard/UpAndDownButton.h +++ b/examples/iotdashboard/UpAndDownButton.h @@ -11,24 +11,24 @@ class RoundButton : QskPushButton { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Panel ) - QSK_STATES( Top ) + public: + QSK_SUBCONTROLS( Panel ) + QSK_STATES( Top ) - RoundButton( QskAspect::Placement placement, QQuickItem* parent ); + RoundButton( QskAspect::Placement placement, QQuickItem* parent ); - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final; + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final; }; class UpAndDownButton : public QskLinearBox { - Q_OBJECT + Q_OBJECT - public: - UpAndDownButton( QQuickItem* parent ); + public: + UpAndDownButton( QQuickItem* parent ); }; #endif // UPANDDOWNBUTTON_H diff --git a/examples/iotdashboard/Usage.h b/examples/iotdashboard/Usage.h index 1a86c0d7..aebdbe4b 100644 --- a/examples/iotdashboard/Usage.h +++ b/examples/iotdashboard/Usage.h @@ -13,32 +13,32 @@ class UsageSpacer : public QskTextLabel { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Text ) + public: + QSK_SUBCONTROLS( Text ) - UsageSpacer( QQuickItem* parent = nullptr ) - : QskTextLabel( "_____", parent ) + UsageSpacer( QQuickItem* parent = nullptr ) + : QskTextLabel( "_____", parent ) + { + } + + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final + { + if( subControl == QskTextLabel::Text ) { + return Text; } - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final - { - if( subControl == QskTextLabel::Text ) - { - return Text; - } - - return subControl; - } + return subControl; + } }; class Usage : public Box { - public: - Usage( QQuickItem* parent ); + public: + Usage( QQuickItem* parent ); }; #endif // USAGE_H diff --git a/examples/iotdashboard/UsageDiagram.cpp b/examples/iotdashboard/UsageDiagram.cpp index 8466b7c6..3e004581 100644 --- a/examples/iotdashboard/UsageDiagram.cpp +++ b/examples/iotdashboard/UsageDiagram.cpp @@ -78,7 +78,7 @@ UsageDiagram::UsageDiagram( QQuickItem* parent ) // These values are calculated with a boost::math::cubic_b_spline. // We just output the values here to get rid of the dependency: - std::vector< std::vector > yValues = + std::vector< std::vector< qreal > > yValues = { {64.00, 64.00, 64.00, 64.00, 64.00, 64.00, 64.00, 64.00, 64.00, 64.00, 64.00, 63.99, 63.96, 63.85, 63.64, 63.30, 62.79, 62.09, 61.14, 59.93, 58.42, 56.59, 54.50, 52.23, 49.84, 47.42, 45.03, 42.76, 40.68, 38.85, 37.36, 36.27, 35.55, 35.19, 35.14, 35.39, 35.91, 36.65, 37.60, 38.73, 40.00, 41.39, 42.87, 44.41, 46.00, 47.60, 49.19, 50.76, 52.26, 53.68, 55.00, 56.19, 57.24, 58.15, 58.90, 59.51, 59.95, 60.23, 60.33, 60.26, 60.00, 59.56, 58.94, 58.17, 57.27, 56.24, 55.12, 53.92, 52.65, 51.34, 50.00, 48.65, 47.32, 46.03, 44.79, 43.65, 42.61, 41.70, 40.95, 40.37, 40.00, 39.85, 39.94, 40.26, 40.84, 41.67, 42.77, 44.15, 45.80, 47.75, 50.00, 52.54, 55.30, 58.19, 61.13, 64.04, 66.82, 69.40, 71.67, 73.57}, {36.00, 36.01, 36.11, 36.37, 36.88, 37.73, 38.98, 40.73, 43.07, 46.06, 49.80, 54.31, 59.38, 64.73, 70.09, 75.20, 79.77, 83.55, 86.24, 87.59, 87.33, 85.26, 81.61, 76.64, 70.67, 63.98, 56.86, 49.61, 42.52, 35.89, 30.00, 25.09, 21.14, 18.08, 15.83, 14.31, 13.45, 13.16, 13.37, 14.01, 15.00, 16.26, 17.73, 19.36, 21.07, 22.82, 24.55, 26.19, 27.68, 28.97, 30.00, 30.73, 31.25, 31.65, 32.04, 32.52, 33.21, 34.19, 35.58, 37.48, 40.00, 43.17, 46.80, 50.61, 54.33, 57.71, 60.47, 62.35, 63.07, 62.38, 60.00, 55.79, 50.12, 43.46, 36.31, 29.13, 22.43, 16.68, 12.37, 9.98, 10.00, 12.73, 17.76, 24.50, 32.36, 40.75, 49.09, 56.77, 63.21, 67.81, 70.00, 69.37, 66.28, 61.29, 54.96, 47.85, 40.51, 33.50, 27.37, 22.68}, @@ -89,7 +89,7 @@ UsageDiagram::UsageDiagram( QQuickItem* parent ) { auto y = yValues[i]; - QVector dataPoints; + QVector< QPointF > dataPoints; dataPoints.reserve( number ); for( int x = 0; x < number; ++x ) diff --git a/examples/iotdashboard/UsageDiagram.h b/examples/iotdashboard/UsageDiagram.h index 44f3aaca..a36fd1bc 100644 --- a/examples/iotdashboard/UsageDiagram.h +++ b/examples/iotdashboard/UsageDiagram.h @@ -18,140 +18,144 @@ class QskGridBox; class WeekdayLabel : public QskTextLabel { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Panel, Text ) + public: + QSK_SUBCONTROLS( Panel, Text ) - WeekdayLabel( const QString& text, QQuickItem* parent ) : QskTextLabel( text, parent ) + WeekdayLabel( const QString& text, QQuickItem* parent ) + : QskTextLabel( text, parent ) + { + setPanel( true ); + } + + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final + { + if( subControl == QskTextLabel::Panel ) { - setPanel( true ); + return Panel; } - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final + if( subControl == QskTextLabel::Text ) { - if( subControl == QskTextLabel::Panel ) - { - return Panel; - } - - if( subControl == QskTextLabel::Text ) - { - return Text; - } - - return subControl; + return Text; } + + return subControl; + } }; class WeekdayBox : public QskBox { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Panel ) + public: + QSK_SUBCONTROLS( Panel ) - WeekdayBox( QQuickItem* parent ) : QskBox( true, parent ) + WeekdayBox( QQuickItem* parent ): + QskBox( true, parent ) + { + } + + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final + { + if( subControl == QskBox::Panel ) { + return WeekdayBox::Panel; } - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final - { - if( subControl == QskBox::Panel ) - { - return WeekdayBox::Panel; - } - - return subControl; - } + return subControl; + } }; class CaptionColorBox : public QskBox { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Panel ) + public: + QSK_SUBCONTROLS( Panel ) - CaptionColorBox( QQuickItem* parent ) : QskBox( true, parent ) + CaptionColorBox( QQuickItem* parent ): + QskBox( true, parent ) + { + } + + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final + { + if( subControl == QskBox::Panel ) { + return Panel; } - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final - { - if( subControl == QskBox::Panel ) - { - return Panel; - } - - return subControl; - } + return subControl; + } }; class CaptionItem : public QskLinearBox { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Panel ) - QSK_STATES( Water, Electricity, Gas ) + public: + QSK_SUBCONTROLS( Panel ) + QSK_STATES( Water, Electricity, Gas ) - CaptionItem( QskAspect::State state, QQuickItem* parent ); + CaptionItem( QskAspect::State state, QQuickItem* parent ); }; class CaptionBox : public QskLinearBox { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Panel ) + public: + QSK_SUBCONTROLS( Panel ) - CaptionBox( QQuickItem* parent ) : QskLinearBox( Qt::Horizontal, parent ) + CaptionBox( QQuickItem* parent ): + QskLinearBox( Qt::Horizontal, parent ) + { + setPanel( true ); + } + + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final + { + if( subControl == QskBox::Panel ) { - setPanel( true ); + return Panel; } - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final - { - if( subControl == QskBox::Panel ) - { - return Panel; - } - - return subControl; - } + return subControl; + } }; class UsageDiagram : public Box { - Q_OBJECT + Q_OBJECT - public: - QSK_SUBCONTROLS( Panel ) + public: + QSK_SUBCONTROLS( Panel ) - UsageDiagram( QQuickItem* parent ); + UsageDiagram( QQuickItem* parent ); - void updateLayout() override; + void updateLayout() override; - QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final + { + if( subControl == QskBox::Panel ) { - if( subControl == QskBox::Panel ) - { - return Panel; - } - - return subControl; + return Panel; } - private: - Diagram* m_diagram; - QskLinearBox* m_captionBox; - QskGridBox* m_weekdays; + return subControl; + } + + private: + Diagram* m_diagram; + QskLinearBox* m_captionBox; + QskGridBox* m_weekdays; }; #endif // USAGEDIAGRAM_H diff --git a/examples/iotdashboard/main.cpp b/examples/iotdashboard/main.cpp index 355ffef2..b2b71dcc 100644 --- a/examples/iotdashboard/main.cpp +++ b/examples/iotdashboard/main.cpp @@ -25,32 +25,33 @@ namespace { class SkinFactory : public QskSkinFactory { - Q_OBJECT + Q_OBJECT - public: - SkinFactory( QObject* parent = nullptr ) : QskSkinFactory( parent ) + public: + SkinFactory( QObject* parent = nullptr ) + : QskSkinFactory( parent ) + { + } + + QStringList skinNames() const override + { + return { "DaytimeSkin", "NighttimeSkin" }; + } + + QskSkin* createSkin( const QString& skinName ) override + { + if( skinName == "DaytimeSkin" ) { + return new DaytimeSkin; } - QStringList skinNames() const override + if( skinName == "NighttimeSkin" ) { - return { "DaytimeSkin", "NighttimeSkin" }; + return new NighttimeSkin; } - QskSkin* createSkin( const QString& skinName ) override - { - if( skinName == "DaytimeSkin" ) - { - return new DaytimeSkin; - } - - if( skinName == "NighttimeSkin" ) - { - return new NighttimeSkin; - } - - return nullptr; - } + return nullptr; + } }; } @@ -79,7 +80,7 @@ int main( int argc, char* argv[] ) // With CTRL-B you can rotate a couple of visual debug modes SkinnyShortcut::enable( SkinnyShortcut::RotateSkin | SkinnyShortcut::DebugBackground | - SkinnyShortcut::DebugStatistics | SkinnyShortcut::Quit ); + SkinnyShortcut::DebugStatistics | SkinnyShortcut::Quit ); MainWindow window; window.show(); diff --git a/examples/iotdashboard/nodes/DiagramDataNode.cpp b/examples/iotdashboard/nodes/DiagramDataNode.cpp index f33e4e6c..cd155df3 100644 --- a/examples/iotdashboard/nodes/DiagramDataNode.cpp +++ b/examples/iotdashboard/nodes/DiagramDataNode.cpp @@ -14,8 +14,9 @@ DiagramDataNode::DiagramDataNode() setMaterial( &m_material ); } -void DiagramDataNode::update( const QRectF& rect, Type type, const QColor& color, const QVector& dataPoints, - const qreal yMax, Qsk::Position position, int lineWidth ) +void DiagramDataNode::update( const QRectF& rect, Type type, + const QColor& color, const QVector< QPointF >& dataPoints, + const qreal yMax, Qsk::Position position, int lineWidth ) { Q_UNUSED( rect ); @@ -65,7 +66,7 @@ void DiagramDataNode::update( const QRectF& rect, Type type, const QColor& color if( m_dataPoints.count() > 0 ) { - xMin = m_dataPoints.at( 0 ).x(); + xMin = m_dataPoints.at( 0 ).x(); xMax = m_dataPoints.at( m_dataPoints.count() - 1 ).x(); } else diff --git a/examples/iotdashboard/nodes/DiagramDataNode.h b/examples/iotdashboard/nodes/DiagramDataNode.h index 94180e6f..00232184 100644 --- a/examples/iotdashboard/nodes/DiagramDataNode.h +++ b/examples/iotdashboard/nodes/DiagramDataNode.h @@ -14,28 +14,28 @@ class DiagramDataNode : public QSGGeometryNode { - public: - enum Type - { - Line, - Area, - }; + public: + enum Type + { + Line, + Area, + }; - DiagramDataNode(); + DiagramDataNode(); - void update( const QRectF& rect, Type type, const QColor& color, const QVector& dataPoints, const qreal yMax, Qsk::Position position, int lineWidth ); + void update( const QRectF& rect, Type type, const QColor& color, const QVector< QPointF >& dataPoints, const qreal yMax, Qsk::Position position, int lineWidth ); - private: - QSGFlatColorMaterial m_material; - QSGGeometry m_geometry; + private: + QSGFlatColorMaterial m_material; + QSGGeometry m_geometry; - QRectF m_rect; - Type m_type; - QColor m_color; - QVector m_dataPoints; - qreal m_yMax; - Qsk::Position m_position; - int m_lineWidth; + QRectF m_rect; + Type m_type; + QColor m_color; + QVector< QPointF > m_dataPoints; + qreal m_yMax; + Qsk::Position m_position; + int m_lineWidth; }; #endif diff --git a/examples/iotdashboard/nodes/DiagramSegmentsNode.cpp b/examples/iotdashboard/nodes/DiagramSegmentsNode.cpp index fc82713b..9ec72f56 100644 --- a/examples/iotdashboard/nodes/DiagramSegmentsNode.cpp +++ b/examples/iotdashboard/nodes/DiagramSegmentsNode.cpp @@ -20,7 +20,8 @@ DiagramSegmentsNode::DiagramSegmentsNode() setMaterial( &m_material ); } -void DiagramSegmentsNode::update( const QRectF& rect, const QColor& color, const QVector >& dataPoints, int xGridLines ) +void DiagramSegmentsNode::update( const QRectF& rect, const QColor& color, + const QVector< QVector< QPointF > >& dataPoints, int xGridLines ) { Q_UNUSED( rect ); diff --git a/examples/iotdashboard/nodes/DiagramSegmentsNode.h b/examples/iotdashboard/nodes/DiagramSegmentsNode.h index 08ff8dfa..9cea4d00 100644 --- a/examples/iotdashboard/nodes/DiagramSegmentsNode.h +++ b/examples/iotdashboard/nodes/DiagramSegmentsNode.h @@ -12,19 +12,19 @@ class DiagramSegmentsNode : public QSGGeometryNode { - public: - DiagramSegmentsNode(); + public: + DiagramSegmentsNode(); - void update( const QRectF& rect, const QColor& color, const QVector< QVector >& dataPoints, int xGridLines ); + void update( const QRectF& rect, const QColor& color, const QVector< QVector< QPointF > >& dataPoints, int xGridLines ); - private: - QSGFlatColorMaterial m_material; - QSGGeometry m_geometry; + private: + QSGFlatColorMaterial m_material; + QSGGeometry m_geometry; - QRectF m_rect; - QColor m_color; - QVector< QVector > m_dataPoints; - int m_xGridLines; + QRectF m_rect; + QColor m_color; + QVector< QVector< QPointF > > m_dataPoints; + int m_xGridLines; }; #endif diff --git a/examples/mycontrols/MySkin.cpp b/examples/mycontrols/MySkin.cpp index 89da079c..468de659 100644 --- a/examples/mycontrols/MySkin.cpp +++ b/examples/mycontrols/MySkin.cpp @@ -191,7 +191,7 @@ class MySkin1 : public MySkin MySkinEditor editor; editor.setTable( &hintTable() ); - editor.setAnimator( 200, QEasingCurve::Linear ); + editor.setAnimator( 200, QEasingCurve::Linear ); editor.setGradient( QskAspect::Control, Qt::gray ); diff --git a/src/common/QskAspect.h b/src/common/QskAspect.h index 3709d992..8116d2a5 100644 --- a/src/common/QskAspect.h +++ b/src/common/QskAspect.h @@ -374,13 +374,13 @@ inline void QskAspect::setPrimitive( Type type, QskAspect::Primitive primitive ) inline constexpr QskAspect::Primitive QskAspect::flagPrimitive() const noexcept { return ( m_bits.type == Flag ) - ? static_cast< Primitive >( m_bits.primitive ) : NoPrimitive; + ? static_cast< Primitive >( m_bits.primitive ) : NoPrimitive; } inline constexpr QskAspect::Primitive QskAspect::colorPrimitive() const noexcept { return ( m_bits.type == Color ) - ? static_cast< Primitive >( m_bits.primitive ) : NoPrimitive; + ? static_cast< Primitive >( m_bits.primitive ) : NoPrimitive; } inline constexpr QskAspect::Primitive QskAspect::metricPrimitive() const noexcept diff --git a/src/controls/QskEvent.h b/src/controls/QskEvent.h index 57a09da0..721953fe 100644 --- a/src/controls/QskEvent.h +++ b/src/controls/QskEvent.h @@ -48,7 +48,7 @@ class QSK_EXPORT QskEvent : public QEvent QskEvent( QskEvent::Type type ); #if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) - virtual QskEvent *clone() const; + virtual QskEvent* clone() const; #endif }; diff --git a/src/controls/QskPageIndicatorSkinlet.cpp b/src/controls/QskPageIndicatorSkinlet.cpp index c4003675..c1940b16 100644 --- a/src/controls/QskPageIndicatorSkinlet.cpp +++ b/src/controls/QskPageIndicatorSkinlet.cpp @@ -127,7 +127,7 @@ QRectF QskPageIndicatorSkinlet::bulletRect( bulletRect.moveTo( x, r.top() + adjust ); else bulletRect.moveTo( r.left() + adjust, x ); - + return bulletRect; } diff --git a/src/controls/QskQuick.cpp b/src/controls/QskQuick.cpp index 746a4b0d..8f6d4f22 100644 --- a/src/controls/QskQuick.cpp +++ b/src/controls/QskQuick.cpp @@ -694,7 +694,7 @@ bool qskGrabMouse( QQuickItem* item ) stored depending on these attributes the following mouse event callbacks will look for the grabber at a a different place as it was stored. - */ + */ if ( const auto event = qskPointerPressEvent( wd ) ) { diff --git a/src/controls/QskQuickItem.cpp b/src/controls/QskQuickItem.cpp index c2164170..746b51ce 100644 --- a/src/controls/QskQuickItem.cpp +++ b/src/controls/QskQuickItem.cpp @@ -737,7 +737,7 @@ void QskQuickItem::itemChange( QQuickItem::ItemChange change, #if QT_VERSION >= QT_VERSION_CHECK( 6, 1, 0 ) auto wd = QQuickWindowPrivate::get( oldWindow )->deliveryAgentPrivate(); -#else +#else auto wd = QQuickWindowPrivate::get( oldWindow ); #endif if ( auto scope = qskNearestFocusScope( this ) ) diff --git a/src/controls/QskQuickItem.h b/src/controls/QskQuickItem.h index 2eab9251..e758b46c 100644 --- a/src/controls/QskQuickItem.h +++ b/src/controls/QskQuickItem.h @@ -131,7 +131,7 @@ class QSK_EXPORT QskQuickItem : public QQuickItem virtual void geometryChangeEvent( QskGeometryChangeEvent* ); virtual void windowChangeEvent( QskWindowChangeEvent* ); - void mouseUngrabEvent() override; + void mouseUngrabEvent() override; void touchUngrabEvent() override; #if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) diff --git a/src/controls/QskSkinHintTableEditor.cpp b/src/controls/QskSkinHintTableEditor.cpp index 54a0f7a6..56f77dd8 100644 --- a/src/controls/QskSkinHintTableEditor.cpp +++ b/src/controls/QskSkinHintTableEditor.cpp @@ -82,7 +82,7 @@ void QskSkinHintTableEditor::setFlag( QskAspect aspect, int flag ) int QskSkinHintTableEditor::flag( QskAspect aspect ) const { - return flagHint( aspect ); + return flagHint< int >( aspect ); } void QskSkinHintTableEditor::setMetric( QskAspect aspect, qreal metric ) @@ -92,7 +92,7 @@ void QskSkinHintTableEditor::setMetric( QskAspect aspect, qreal metric ) qreal QskSkinHintTableEditor::metric( QskAspect aspect ) const { - return metricHint( aspect ); + return metricHint< qreal >( aspect ); } void QskSkinHintTableEditor::setColor( QskAspect aspect, Qt::GlobalColor color ) @@ -112,7 +112,7 @@ void QskSkinHintTableEditor::setColor( QskAspect aspect, const QColor& color ) QColor QskSkinHintTableEditor::color( QskAspect aspect ) const { - return colorHint( aspect ); + return colorHint< QColor >( aspect ); } void QskSkinHintTableEditor::setHGradient( @@ -134,7 +134,7 @@ void QskSkinHintTableEditor::setGradient( QskAspect aspect, const QskGradient& g QskGradient QskSkinHintTableEditor::gradient( QskAspect aspect ) const { - return colorHint( aspect ); + return colorHint< QskGradient >( aspect ); } void QskSkinHintTableEditor::setStrutSize( QskAspect aspect, const QSizeF& size ) @@ -231,7 +231,7 @@ Qt::Alignment QskSkinHintTableEditor::alignment( QskAspect aspect ) const void QskSkinHintTableEditor::setFontRole( QskAspect aspect, int fontRole ) { - setFlagHint( aspectFontRole( aspect ), fontRole ); + setFlagHint( aspectFontRole( aspect ), fontRole ); } void QskSkinHintTableEditor::removeFontRole( QskAspect aspect ) @@ -246,7 +246,7 @@ int QskSkinHintTableEditor::fontRole( QskAspect aspect ) const void QskSkinHintTableEditor::setGraphicRole( QskAspect aspect, int graphicRole ) { - setFlagHint( aspectGraphicRole( aspect ), graphicRole ); + setFlagHint( aspectGraphicRole( aspect ), graphicRole ); } void QskSkinHintTableEditor::removeGraphicRole( QskAspect aspect ) diff --git a/src/controls/QskSkinHintTableEditor.h b/src/controls/QskSkinHintTableEditor.h index 67253b8b..175b410a 100644 --- a/src/controls/QskSkinHintTableEditor.h +++ b/src/controls/QskSkinHintTableEditor.h @@ -118,7 +118,7 @@ class QSK_EXPORT QskSkinHintTableEditor void setGraphicRole( QskAspect, int ); void removeGraphicRole( QskAspect ); int graphicRole( QskAspect ) const; - + void setBoxShape( QskAspect, qreal radius, Qt::SizeMode = Qt::AbsoluteSize ); void setBoxShape( QskAspect, qreal topLeft, qreal topRight, qreal bottomLeft, qreal bottomRight, Qt::SizeMode = Qt::AbsoluteSize ); diff --git a/src/controls/QskSkinnable.cpp b/src/controls/QskSkinnable.cpp index 16ca76ce..4b3ec917 100644 --- a/src/controls/QskSkinnable.cpp +++ b/src/controls/QskSkinnable.cpp @@ -56,7 +56,7 @@ static inline QVariant qskTypedNullValue( const QVariant& value ) } static inline bool qskSetFlag( QskSkinnable* skinnable, - const QskAspect aspect, int flag ) + const QskAspect aspect, int flag ) { return skinnable->setSkinHint( aspect | QskAspect::Flag, QVariant( flag ) ); } @@ -68,7 +68,7 @@ static inline int qskFlag( const QskSkinnable* skinnable, } static inline bool qskSetMetric( QskSkinnable* skinnable, - const QskAspect aspect, const QVariant& metric ) + const QskAspect aspect, const QVariant& metric ) { return skinnable->setSkinHint( aspect | QskAspect::Metric, metric ); } @@ -553,7 +553,7 @@ QskColorFilter QskSkinnable::effectiveGraphicFilter( QskAspect aspect ) const if ( auto control = owningControl() ) { v = QskSkinTransition::animatedGraphicFilter( - control->window(), hint.toInt() ); + control->window(), hint.toInt() ); if ( v.canConvert< QskColorFilter >() ) { diff --git a/src/controls/QskStatusIndicator.cpp b/src/controls/QskStatusIndicator.cpp index f2b7c99f..d27a8d90 100644 --- a/src/controls/QskStatusIndicator.cpp +++ b/src/controls/QskStatusIndicator.cpp @@ -54,7 +54,7 @@ class QskStatusIndicator::PrivateData int currentStatus; QMap< int, StatusData > map; - mutable QList statusList; + mutable QList< int > statusList; }; QskStatusIndicator::QskStatusIndicator( QQuickItem* parent ) @@ -211,7 +211,7 @@ void QskStatusIndicator::setStatus( int status ) update(); } -QList QskStatusIndicator::statusList() const +QList< int > QskStatusIndicator::statusList() const { /* We should be have a QMap< int, QskGraphic >, so that diff --git a/src/controls/QskSwitchButton.cpp b/src/controls/QskSwitchButton.cpp index 3f94e871..a30079d6 100644 --- a/src/controls/QskSwitchButton.cpp +++ b/src/controls/QskSwitchButton.cpp @@ -22,7 +22,7 @@ QskSwitchButton::QskSwitchButton( QQuickItem* parent ) QskSwitchButton::QskSwitchButton( Qt::Orientation orientation, QQuickItem* parent ) : QskAbstractButton( parent ) , m_data( new PrivateData( orientation ) ) -{ +{ initSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed ); } @@ -72,7 +72,7 @@ void QskSwitchButton::setInverted( bool on ) } QskAspect::Placement QskSwitchButton::effectivePlacement() const -{ +{ /* So you can define different hints depending on the orientation, but what about the layoutDirection ??? diff --git a/src/controls/QskSwitchButtonSkinlet.cpp b/src/controls/QskSwitchButtonSkinlet.cpp index 57e5bcdb..1a31b35a 100644 --- a/src/controls/QskSwitchButtonSkinlet.cpp +++ b/src/controls/QskSwitchButtonSkinlet.cpp @@ -110,7 +110,7 @@ QRectF QskSwitchButtonSkinlet::grooveRect( size = size.expandedTo( QSize( 0.0, 0.0 ) ); - QRectF r; + QRectF r; r.setSize( size ); r.moveCenter( contentsRect.center() ); diff --git a/src/controls/QskTabBar.cpp b/src/controls/QskTabBar.cpp index 684914b2..c4cd1639 100644 --- a/src/controls/QskTabBar.cpp +++ b/src/controls/QskTabBar.cpp @@ -449,7 +449,7 @@ int QskTabBar::insertTab( int index, QskTabButton* button ) m_data->connectButton( button, this, true ); connect( button, &QskAbstractButton::clicked, - this, &QskTabBar::handleButtonClick ); + this, &QskTabBar::handleButtonClick ); Q_EMIT countChanged( count() ); diff --git a/src/controls/QskTabButton.cpp b/src/controls/QskTabButton.cpp index b3f40269..bbfe2166 100644 --- a/src/controls/QskTabButton.cpp +++ b/src/controls/QskTabButton.cpp @@ -15,7 +15,7 @@ QSK_SUBCONTROL( QskTabButton, Panel ) QSK_SUBCONTROL( QskTabButton, Text ) -static inline QskTabBar* qskFindTabBar( QskTabButton* button ) +static inline QskTabBar* qskFindTabBar( const QskTabButton* button ) { return qskFindAncestorOf< QskTabBar* >( button->parentItem() ); } diff --git a/src/controls/QskTextInput.cpp b/src/controls/QskTextInput.cpp index c6b5d179..f89f66a1 100644 --- a/src/controls/QskTextInput.cpp +++ b/src/controls/QskTextInput.cpp @@ -331,20 +331,20 @@ QskTextInput::~QskTextInput() { } -void QskTextInput::setPanel( bool on ) -{ +void QskTextInput::setPanel( bool on ) +{ if ( on != m_data->hasPanel ) { m_data->hasPanel = on; - + resetImplicitSize(); polish(); update(); } -} - +} + bool QskTextInput::hasPanel() const -{ +{ return m_data->hasPanel; } diff --git a/src/controls/QskTextInputSkinlet.cpp b/src/controls/QskTextInputSkinlet.cpp index 6be2cd05..5d451192 100644 --- a/src/controls/QskTextInputSkinlet.cpp +++ b/src/controls/QskTextInputSkinlet.cpp @@ -41,7 +41,7 @@ QSGNode* QskTextInputSkinlet::updateSubNode( const auto input = static_cast< const QskTextInput* >( skinnable ); if ( !input->hasPanel() ) return nullptr; - + return updateBoxNode( skinnable, node, QskTextInput::Panel ); } } diff --git a/src/inputpanel/QskInputPanelBox.cpp b/src/inputpanel/QskInputPanelBox.cpp index 06364503..64b3a5b7 100644 --- a/src/inputpanel/QskInputPanelBox.cpp +++ b/src/inputpanel/QskInputPanelBox.cpp @@ -18,8 +18,7 @@ namespace class TextInputProxy final : public QskTextInput { public: - TextInputProxy( QskInputPanelBox* panelBox, - QQuickItem* parentItem = nullptr ) + TextInputProxy( QskInputPanelBox* panelBox, QQuickItem* parentItem = nullptr ) : QskTextInput( parentItem ) , m_panelBox( panelBox ) { diff --git a/src/layouts/QskGridBox.cpp b/src/layouts/QskGridBox.cpp index 5dbe302a..f5d49516 100644 --- a/src/layouts/QskGridBox.cpp +++ b/src/layouts/QskGridBox.cpp @@ -496,8 +496,8 @@ void QskGridBox::dump() const const auto constraint = sizeConstraint(); debug << "QskGridBox" - << "[" << engine.columnCount() << "," << engine.rowCount() << "] w:" - << constraint.width() << " h:" << constraint.height() << '\n'; + << "[" << engine.columnCount() << "," << engine.rowCount() << "] w:" + << constraint.width() << " h:" << constraint.height() << '\n'; for ( int i = 0; i < engine.count(); i++ ) { @@ -521,7 +521,7 @@ void QskGridBox::dump() const const auto constraint = qskSizeConstraint( item, Qt::PreferredSize ); debug << item->metaObject()->className() - << " w:" << constraint.width() << " h:" << constraint.height(); + << " w:" << constraint.width() << " h:" << constraint.height(); } else { diff --git a/src/layouts/QskLinearBox.cpp b/src/layouts/QskLinearBox.cpp index 5cd1ecc2..8b445ca6 100644 --- a/src/layouts/QskLinearBox.cpp +++ b/src/layouts/QskLinearBox.cpp @@ -541,7 +541,7 @@ void QskLinearBox::dump() const const auto constraint = sizeConstraint(); debug << "QskLinearBox" << engine.orientation() - << " w:" << constraint.width() << " h:" << constraint.height() << '\n'; + << " w:" << constraint.width() << " h:" << constraint.height() << '\n'; for ( int i = 0; i < engine.count(); i++ ) { @@ -551,7 +551,7 @@ void QskLinearBox::dump() const { const auto constraint = qskSizeConstraint( item, Qt::PreferredSize ); debug << item->metaObject()->className() - << " w:" << constraint.width() << " h:" << constraint.height(); + << " w:" << constraint.width() << " h:" << constraint.height(); } else { diff --git a/src/layouts/QskStackBox.cpp b/src/layouts/QskStackBox.cpp index dbec8c2b..c4fdbee9 100644 --- a/src/layouts/QskStackBox.cpp +++ b/src/layouts/QskStackBox.cpp @@ -427,7 +427,7 @@ void QskStackBox::dump() const const auto constraint = sizeConstraint(); debug << "QskStackBox" - << " w:" << constraint.width() << " h:" << constraint.height() << '\n'; + << " w:" << constraint.width() << " h:" << constraint.height() << '\n'; for ( int i = 0; i < m_data->items.count(); i++ ) { @@ -437,7 +437,7 @@ void QskStackBox::dump() const const auto constraint = qskSizeConstraint( item, Qt::PreferredSize ); debug << item->metaObject()->className() - << " w:" << constraint.width() << " h:" << constraint.height(); + << " w:" << constraint.width() << " h:" << constraint.height(); if ( i == m_data->currentIndex ) debug << " [X]"; diff --git a/src/nodes/QskScaleRenderer.h b/src/nodes/QskScaleRenderer.h index b6b4d1d8..b17a9d55 100644 --- a/src/nodes/QskScaleRenderer.h +++ b/src/nodes/QskScaleRenderer.h @@ -42,7 +42,7 @@ class QSK_EXPORT QskScaleRenderer const QRectF& tickmarksRect, const QRectF& labelsRect, QSGNode* ); virtual QVariant labelAt( qreal pos ) const; - QSizeF boundingLabelSize() const; + QSizeF boundingLabelSize() const; virtual QSGNode* updateTicksNode( const QskSkinnable*, const QRectF&, QSGNode* ) const; diff --git a/support/SkinnyShortcut.cpp b/support/SkinnyShortcut.cpp index 6471628b..44a3d423 100644 --- a/support/SkinnyShortcut.cpp +++ b/support/SkinnyShortcut.cpp @@ -251,7 +251,7 @@ void SkinnyShortcut::debugStatistics() countItems( w->contentItem(), counter ); qDebug() << w << "\n\titems:" << counter[0] << "visible" << counter[1] - << "\n\tnodes:" << counter[2] << "visible" << counter[3]; + << "\n\tnodes:" << counter[2] << "visible" << counter[3]; } }