uncrustified

This commit is contained in:
Uwe Rathmann 2021-08-04 09:31:16 +02:00
parent 66cc68bcda
commit 923affe749
64 changed files with 863 additions and 848 deletions

View File

@ -12,18 +12,19 @@ class QskTextLabel;
class Box : public QskLinearBox class Box : public QskLinearBox
{ {
Q_OBJECT Q_OBJECT
public:
QSK_SUBCONTROLS( Panel )
Box( const QString& title, QQuickItem* parent ); public:
QSK_SUBCONTROLS( Panel )
QskAspect::Subcontrol effectiveSubcontrol( Box( const QString& title, QQuickItem* parent );
QskAspect::Subcontrol subControl ) const override;
private: QskAspect::Subcontrol effectiveSubcontrol(
QString m_title; QskAspect::Subcontrol subControl ) const override;
QskTextLabel* m_label;
private:
QString m_title;
QskTextLabel* m_label;
}; };
#endif // BOX_H #endif // BOX_H

View File

@ -14,91 +14,92 @@
class ButtonValueLabel : public QskTextLabel class ButtonValueLabel : public QskTextLabel
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Text ) 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( return subControl;
QskAspect::Subcontrol subControl ) const override final }
{
if( subControl == QskTextLabel::Text )
{
return Text;
}
return subControl;
}
}; };
class TitleAndValueBox : public QskLinearBox class TitleAndValueBox : public QskLinearBox
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Panel ) QSK_SUBCONTROLS( Panel )
TitleAndValueBox( Qt::Orientation orientation, QQuickItem* parent ) TitleAndValueBox( Qt::Orientation orientation, QQuickItem* parent )
: QskLinearBox( orientation, 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( return subControl;
QskAspect::Subcontrol subControl ) const override final }
{
if( subControl == QskLinearBox::Panel )
{
return Panel;
}
return subControl;
}
}; };
class BoxWithButtons : public Box class BoxWithButtons : public Box
{ {
public: public:
QSK_SUBCONTROLS( Panel ) 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 effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override QskAspect::Subcontrol subControl ) const override
{
if( subControl == QskBox::Panel )
{ {
if( subControl == QskBox::Panel ) return Panel;
{
return Panel;
}
return subControl;
} }
return subControl;
}
}; };
class IndoorTemperature : public BoxWithButtons class IndoorTemperature : public BoxWithButtons
{ {
public: public:
QSK_SUBCONTROLS( Panel ) QSK_SUBCONTROLS( Panel )
IndoorTemperature( QQuickItem* parent ) IndoorTemperature( QQuickItem* parent )
: BoxWithButtons( "Indoor Temperature", "+24", true, parent ) : BoxWithButtons( "Indoor Temperature", "+24", true, parent )
{ {
} }
}; };
class Humidity: public BoxWithButtons class Humidity : public BoxWithButtons
{ {
public: public:
QSK_SUBCONTROLS( Panel ) QSK_SUBCONTROLS( Panel )
Humidity( QQuickItem* parent ) Humidity( QQuickItem* parent )
: BoxWithButtons( "Humidity", "30%", false, parent ) : BoxWithButtons( "Humidity", "30%", false, parent )
{ {
} }
}; };
#endif // BOXWITHBUTTONS_H #endif // BOXWITHBUTTONS_H

View File

@ -13,47 +13,47 @@
class CircularProgressBar : public QQuickPaintedItem class CircularProgressBar : public QQuickPaintedItem
{ {
public: public:
CircularProgressBar( const QskGradient& gradient, int progress, QQuickItem* parent = nullptr ); CircularProgressBar( const QskGradient& gradient, int progress, QQuickItem* parent = nullptr );
virtual void paint( QPainter* painter ) override; virtual void paint( QPainter* painter ) override;
double width() const double width() const
{ {
return m_width; return m_width;
} }
void setWidth( double width ) void setWidth( double width )
{ {
m_width = width; m_width = width;
} }
QColor backgroundColor() const QColor backgroundColor() const
{ {
return m_backgroundColor; return m_backgroundColor;
} }
void setBackgroundColor( const QColor& color ) void setBackgroundColor( const QColor& color )
{ {
m_backgroundColor = color; m_backgroundColor = color;
} }
QRadialGradient ringGradient() const QRadialGradient ringGradient() const
{ {
return m_ringGradient; return m_ringGradient;
} }
void setRingGradient( const QRadialGradient& gradient ) void setRingGradient( const QRadialGradient& gradient )
{ {
m_ringGradient = gradient; m_ringGradient = gradient;
} }
private: private:
QGradient m_gradient; QGradient m_gradient;
QColor m_backgroundColor; QColor m_backgroundColor;
QRadialGradient m_ringGradient; QRadialGradient m_ringGradient;
double m_width = 20; double m_width = 20;
int m_progress; int m_progress;
}; };
#endif // CIRCULARPROGRESSBAR_H #endif // CIRCULARPROGRESSBAR_H

View File

@ -7,16 +7,12 @@
class Diagram::PrivateData class Diagram::PrivateData
{ {
public: public:
PrivateData() QVector< QVector< QPointF > > dataPoints;
{ int xGridLines = -1;
} qreal yMax = -1;
Qsk::Position position = Qsk::Bottom;
QVector<QVector<QPointF> > dataPoints; QVector< Types > types;
int xGridLines = -1;
qreal yMax = -1;
Qsk::Position position = Qsk::Bottom;
QVector<Types> types;
}; };
QSK_SUBCONTROL( Diagram, Chart ) QSK_SUBCONTROL( Diagram, Chart )
@ -38,12 +34,12 @@ Diagram::~Diagram()
{ {
} }
QVector< QVector<QPointF> > Diagram::dataPoints() const QVector< QVector< QPointF > > Diagram::dataPoints() const
{ {
return m_data->dataPoints; return m_data->dataPoints;
} }
void Diagram::addDataPoints( const QVector<QPointF>& dataPoints, const Types& types ) void Diagram::addDataPoints( const QVector< QPointF >& dataPoints, const Types& types )
{ {
m_data->dataPoints.append( dataPoints ); m_data->dataPoints.append( dataPoints );
m_data->types.append( types ); m_data->types.append( types );

View File

@ -11,44 +11,44 @@
class Diagram : public QskControl class Diagram : public QskControl
{ {
Q_OBJECT Q_OBJECT
using Inherited = QskControl; using Inherited = QskControl;
public: public:
QSK_SUBCONTROLS( Chart, Segments, ChartLine1, ChartArea1, ChartLine2, ChartArea2, ChartLine3, ChartArea3 ) QSK_SUBCONTROLS( Chart, Segments, ChartLine1, ChartArea1, ChartLine2, ChartArea2, ChartLine3, ChartArea3 )
enum Type enum Type
{ {
Line = 0x01, Line = 0x01,
Area = 0x02, Area = 0x02,
}; };
Q_DECLARE_FLAGS( Types, Type ) Q_DECLARE_FLAGS( Types, Type )
Diagram( QQuickItem* parent = nullptr ); Diagram( QQuickItem* parent = nullptr );
~Diagram() override; ~Diagram() override;
QVector< QVector<QPointF> > dataPoints() const; QVector< QVector< QPointF > > dataPoints() const;
void addDataPoints( const QVector<QPointF>& dataPoints, const Types& types ); void addDataPoints( const QVector< QPointF >& dataPoints, const Types& types );
Types typesAt( uint pos ) const; Types typesAt( uint pos ) const;
qreal yMax() const; qreal yMax() const;
void setYMax( qreal yMax ); void setYMax( qreal yMax );
int xGridLines() const; int xGridLines() const;
void setXGridLines( int lines ); void setXGridLines( int lines );
Qsk::Position chartPosition() const; Qsk::Position chartPosition() const;
void setChartPosition( Qsk::Position position ); void setChartPosition( Qsk::Position position );
protected: protected:
QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override; QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
private: private:
class PrivateData; class PrivateData;
std::unique_ptr< PrivateData > m_data; std::unique_ptr< PrivateData > m_data;
}; };
Q_DECLARE_OPERATORS_FOR_FLAGS( Diagram::Types ) Q_DECLARE_OPERATORS_FOR_FLAGS( Diagram::Types )

View File

@ -71,14 +71,14 @@ QSGNode* DiagramSkinlet::updateSubNode(
switch( nodeRole ) switch( nodeRole )
{ {
case ChartRole: case ChartRole:
{ {
return updateChartNode( discharge, node ); return updateChartNode( discharge, node );
} }
case SeparatorRole: case SeparatorRole:
{ {
return updateSeparatorNode( discharge, node ); return updateSeparatorNode( discharge, node );
} }
} }
return nullptr; return nullptr;
@ -95,7 +95,7 @@ QSGNode* DiagramSkinlet::updateChartNode( const Diagram* diagram, QSGNode* node
const QRectF rect = diagram->subControlRect( Q::Chart ); const QRectF rect = diagram->subControlRect( Q::Chart );
const qreal yMax = diagram->yMax(); const qreal yMax = diagram->yMax();
const Qsk::Position position = diagram->chartPosition(); const Qsk::Position position = diagram->chartPosition();
QVector<Diagram::Type> types = {Diagram::Line, Diagram::Area}; QVector< Diagram::Type > types = { Diagram::Line, Diagram::Area };
for( int i = 0; i < diagram->dataPoints().size(); ++i ) for( int i = 0; i < diagram->dataPoints().size(); ++i )
{ {
@ -111,7 +111,7 @@ QSGNode* DiagramSkinlet::updateChartNode( const Diagram* diagram, QSGNode* node
node->appendChildNode( chartNode ); node->appendChildNode( chartNode );
} }
const QVector<QPointF> dataPoints = diagram->dataPoints().at( i ); const QVector< QPointF > dataPoints = diagram->dataPoints().at( i );
int nodeIndex = 0; int nodeIndex = 0;
QskAspect::Subcontrol lineSubcontrol = lineForIndex( i ); QskAspect::Subcontrol lineSubcontrol = lineForIndex( i );
QskAspect::Subcontrol areaSubcontrol = areaForIndex( i ); QskAspect::Subcontrol areaSubcontrol = areaForIndex( i );
@ -125,7 +125,7 @@ QSGNode* DiagramSkinlet::updateChartNode( const Diagram* diagram, QSGNode* node
if( chartNode->childCount() > nodeIndex ) if( chartNode->childCount() > nodeIndex )
{ {
dataPointNode = static_cast<DiagramDataNode*>( chartNode->childAtIndex( nodeIndex ) ); dataPointNode = static_cast< DiagramDataNode* >( chartNode->childAtIndex( nodeIndex ) );
} }
else else
{ {
@ -162,7 +162,7 @@ QSGNode* DiagramSkinlet::updateSeparatorNode( const Diagram* diagram, QSGNode* n
return nullptr; return nullptr;
} }
auto* separatorNode = static_cast<DiagramSegmentsNode*>( node ); auto* separatorNode = static_cast< DiagramSegmentsNode* >( node );
if( separatorNode == nullptr ) if( separatorNode == nullptr )
{ {
@ -172,7 +172,7 @@ QSGNode* DiagramSkinlet::updateSeparatorNode( const Diagram* diagram, QSGNode* n
using Q = Diagram; using Q = Diagram;
const QRectF rect = diagram->subControlRect( Q::Chart ); const QRectF rect = diagram->subControlRect( Q::Chart );
const QColor color = diagram->color( Q::Segments ); const QColor color = diagram->color( Q::Segments );
const QVector< QVector<QPointF> > dataPoints = diagram->dataPoints(); const QVector< QVector< QPointF > > dataPoints = diagram->dataPoints();
separatorNode->update( rect, color, dataPoints, xGridLines ); separatorNode->update( rect, color, dataPoints, xGridLines );

View File

@ -12,31 +12,31 @@ class Diagram;
class DiagramSkinlet : public QskSkinlet class DiagramSkinlet : public QskSkinlet
{ {
Q_GADGET Q_GADGET
using Inherited = QskSkinlet; using Inherited = QskSkinlet;
public: public:
enum NodeRole enum NodeRole
{ {
ChartRole, ChartRole,
SeparatorRole, SeparatorRole,
}; };
Q_INVOKABLE DiagramSkinlet( QskSkin* = nullptr ); Q_INVOKABLE DiagramSkinlet( QskSkin* = nullptr );
~DiagramSkinlet() override; ~DiagramSkinlet() override;
QRectF subControlRect( const QskSkinnable*, QRectF subControlRect( const QskSkinnable*,
const QRectF&, QskAspect::Subcontrol ) const override; const QRectF&, QskAspect::Subcontrol ) const override;
protected: protected:
QSGNode* updateSubNode( const QskSkinnable*, QSGNode* updateSubNode( const QskSkinnable*,
quint8 nodeRole, QSGNode* ) const override; quint8 nodeRole, QSGNode* ) const override;
private: private:
QSGNode* updateChartNode( const Diagram*, QSGNode* ) const; QSGNode* updateChartNode( const Diagram*, QSGNode* ) const;
QSGNode* updateSeparatorNode( const Diagram*, QSGNode* ) const; QSGNode* updateSeparatorNode( const Diagram*, QSGNode* ) const;
}; };
#endif // DIAGRAM_SKINLET_H #endif // DIAGRAM_SKINLET_H

View File

@ -34,51 +34,51 @@ namespace
// ### There must be an easier way to do this // ### There must be an easier way to do this
class DimmerAnimator : public QskAnimator class DimmerAnimator : public QskAnimator
{ {
public: public:
DimmerAnimator( LightDisplay* display, LightDimmer* dimmer ) DimmerAnimator( LightDisplay* display, LightDimmer* dimmer )
: m_display( display ) : m_display( display )
, m_dimmer( dimmer ) , 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<QQuickWindow*>( qGuiApp->allWindows().at( 0 ) ); QColor c = stop.second;
setWindow( w ); QColor c2 = invertedColor( c );
setDuration( 500 ); const QColor newColor = QskRgb::interpolated( c, c2, value );
setEasingCurve( QEasingCurve::Linear ); newGradient.setColorAt( stop.first, newColor );
setAutoRepeat( false );
} }
void setup() override m_dimmer->setRingGradient( newGradient );
{ m_dimmer->update();
m_backgroundColor = m_display->color( LightDisplay::Panel ); }
m_ringGradient = m_dimmer->ringGradient();
}
void advance( qreal value ) override private:
{ QColor m_backgroundColor;
const QColor c = m_backgroundColor; QRadialGradient m_ringGradient;
const QColor c2 = invertedColor( c ); LightDisplay* m_display;
const QColor newColor = QskRgb::interpolated( c2, c, value ); LightDimmer* m_dimmer;
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;
}; };
LightDimmer::LightDimmer( const QskGradient& coldGradient, const QskGradient& warmGradient, QQuickItem* parent ) LightDimmer::LightDimmer( const QskGradient& coldGradient, const QskGradient& warmGradient, QQuickItem* parent )

View File

@ -18,103 +18,104 @@ class QskTextLabel;
class LightIntensityValueLabel : public QskTextLabel class LightIntensityValueLabel : public QskTextLabel
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Text ) 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( return subControl;
QskAspect::Subcontrol subControl ) const override final }
{
if( subControl == QskTextLabel::Text )
{
return Text;
}
return subControl;
}
}; };
class LightDimmer: public QQuickPaintedItem class LightDimmer : public QQuickPaintedItem
{ {
Q_OBJECT Q_OBJECT
public: public:
LightDimmer( const QskGradient& coldGradient, const QskGradient& warmGradient, QQuickItem* parent ); LightDimmer( const QskGradient& coldGradient, const QskGradient& warmGradient, QQuickItem* parent );
double thickness() const double thickness() const
{ {
return m_thickness; return m_thickness;
} }
void setThickness( double thickness ) void setThickness( double thickness )
{ {
m_thickness = thickness; m_thickness = thickness;
} }
QColor backgroundColor() const QColor backgroundColor() const
{ {
return m_backgroundColor; return m_backgroundColor;
} }
void setBackgroundColor( const QColor& color ) void setBackgroundColor( const QColor& color )
{ {
m_backgroundColor = color; m_backgroundColor = color;
} }
QRadialGradient ringGradient() const QRadialGradient ringGradient() const
{ {
return m_ringGradient; return m_ringGradient;
} }
void setRingGradient( const QRadialGradient& gradient ) void setRingGradient( const QRadialGradient& gradient )
{ {
m_ringGradient = gradient; m_ringGradient = gradient;
} }
private: private:
double m_thickness = 17.57; double m_thickness = 17.57;
QColor m_backgroundColor; QColor m_backgroundColor;
QRadialGradient m_ringGradient; QRadialGradient m_ringGradient;
QskGradient m_coldGradient; QskGradient m_coldGradient;
QskGradient m_warmGradient; QskGradient m_warmGradient;
virtual void paint( QPainter* painter ) override; virtual void paint( QPainter* painter ) override;
}; };
class LightDisplay : public QskControl class LightDisplay : public QskControl
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Panel, ColdPart, WarmPart ) QSK_SUBCONTROLS( Panel, ColdPart, WarmPart )
LightDisplay( QQuickItem* parent ); LightDisplay( QQuickItem* parent );
QskAspect::Subcontrol effectiveSubcontrol( QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override final; QskAspect::Subcontrol subControl ) const override final;
protected: protected:
void updateLayout() override; void updateLayout() override;
private: private:
QskTextLabel* m_leftLabel; QskTextLabel* m_leftLabel;
LightIntensityValueLabel* m_centreLabel; LightIntensityValueLabel* m_centreLabel;
QskTextLabel* m_rightLabel; QskTextLabel* m_rightLabel;
LightDimmer* m_dimmer; LightDimmer* m_dimmer;
DimmerAnimator* m_animator; DimmerAnimator* m_animator;
}; };
class LightIntensity : public Box class LightIntensity : public Box
{ {
Q_OBJECT Q_OBJECT
public: public:
LightIntensity( QQuickItem* parent ); LightIntensity( QQuickItem* parent );
}; };
#endif // LIGHTINTENSITY_H #endif // LIGHTINTENSITY_H

View File

@ -32,7 +32,8 @@ QSK_SUBCONTROL( ShadowPositioner, Panel )
QSK_SUBCONTROL( MainContent, Panel ) QSK_SUBCONTROL( MainContent, Panel )
QSK_SUBCONTROL( MainContentGridBox, Panel ) QSK_SUBCONTROL( MainContentGridBox, Panel )
ShadowPositioner::ShadowPositioner( QQuickItem* parent ) : QskControl( parent ) ShadowPositioner::ShadowPositioner( QQuickItem* parent )
: QskControl( parent )
{ {
setAutoLayoutChildren( true ); setAutoLayoutChildren( true );
} }
@ -68,7 +69,7 @@ void ShadowPositioner::setGridBox( QskGridBox* gridBox )
void ShadowPositioner::updateLayout() void ShadowPositioner::updateLayout()
{ {
auto* mainContent = static_cast<QskLinearBox*>( parentItem() ); auto* mainContent = static_cast< QskLinearBox* >( parentItem() );
QTimer::singleShot( 0, this, [this, mainContent]() 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 ); setAutoAddChildren( false );
setSizePolicy( QskSizePolicy::Expanding, QskSizePolicy::Expanding ); setSizePolicy( QskSizePolicy::Expanding, QskSizePolicy::Expanding );

View File

@ -13,63 +13,63 @@ class ShadowedRectangle;
class ShadowPositioner : public QskControl class ShadowPositioner : public QskControl
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Panel ) QSK_SUBCONTROLS( Panel )
ShadowPositioner( QQuickItem* parent ); ShadowPositioner( QQuickItem* parent );
void updateLayout() override; void updateLayout() override;
void setGridBox( QskGridBox* gridBox ); void setGridBox( QskGridBox* gridBox );
private: private:
QskGridBox* m_gridBox; QskGridBox* m_gridBox;
QVector<ShadowedRectangle*> m_rectangles; QVector< ShadowedRectangle* > m_rectangles;
}; };
class MainContentGridBox : public QskGridBox class MainContentGridBox : public QskGridBox
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Panel ) QSK_SUBCONTROLS( Panel )
MainContentGridBox( QQuickItem* parent = nullptr ) MainContentGridBox( QQuickItem* parent = nullptr )
: QskGridBox( parent ) : QskGridBox( parent )
{
}
QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override final
{
if( subControl == QskGridBox::Panel )
{ {
return Panel;
} }
QskAspect::Subcontrol effectiveSubcontrol( return subControl;
QskAspect::Subcontrol subControl ) const override final }
{
if( subControl == QskGridBox::Panel )
{
return Panel;
}
return subControl;
}
}; };
class MainContent : public QskLinearBox class MainContent : public QskLinearBox
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Panel ) QSK_SUBCONTROLS( Panel )
MainContent( QQuickItem* parent ); MainContent( QQuickItem* parent );
QskAspect::Subcontrol effectiveSubcontrol( QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override final; QskAspect::Subcontrol subControl ) const override final;
protected: protected:
void geometryChangeEvent( QskGeometryChangeEvent* ) override; void geometryChangeEvent( QskGeometryChangeEvent* ) override;
private: private:
QList< QskLinearBox* > m_columns; QList< QskLinearBox* > m_columns;
ShadowPositioner* m_shadowPositioner; ShadowPositioner* m_shadowPositioner;
}; };
#endif // MAINCONTENT_H #endif // MAINCONTENT_H

View File

@ -14,15 +14,15 @@ class QskLinearBox;
class MainWindow : public QskWindow class MainWindow : public QskWindow
{ {
Q_OBJECT Q_OBJECT
public: public:
MainWindow(); MainWindow();
private: private:
QskLinearBox* m_mainLayout; QskLinearBox* m_mainLayout;
MenuBar* m_menuBar; MenuBar* m_menuBar;
MainContent* m_mainContent; MainContent* m_mainContent;
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View File

@ -21,8 +21,9 @@ QSK_SUBCONTROL( MenuBar, Panel )
QSK_STATE( MenuItem, Active, ( QskAspect::FirstUserState << 1 ) ) QSK_STATE( MenuItem, Active, ( QskAspect::FirstUserState << 1 ) )
MenuItem::MenuItem( const QString& name, QQuickItem* parent ) : QskLinearBox( Qt::Horizontal, parent ), MenuItem::MenuItem( const QString& name, QQuickItem* parent )
m_name( name ) : QskLinearBox( Qt::Horizontal, parent )
, m_name( name )
{ {
setAutoLayoutChildren( true ); setAutoLayoutChildren( true );
setAutoAddChildren( 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 ); setPanel( true );
setSizePolicy( QskSizePolicy::Minimum, QskSizePolicy::Preferred ); setSizePolicy( QskSizePolicy::Minimum, QskSizePolicy::Preferred );

View File

@ -12,108 +12,108 @@
class MenuBarTopLabel final : public QskGraphicLabel class MenuBarTopLabel final : public QskGraphicLabel
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Graphic ) QSK_SUBCONTROLS( Graphic )
MenuBarTopLabel( const QskGraphic& graphic, QQuickItem* parent = nullptr ) MenuBarTopLabel( const QskGraphic& graphic, QQuickItem* parent = nullptr )
: QskGraphicLabel( graphic, parent ) : QskGraphicLabel( graphic, parent )
{
}
QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override
{
if( subControl == QskGraphicLabel::Graphic )
{ {
return Graphic;
} }
QskAspect::Subcontrol effectiveSubcontrol( return subControl;
QskAspect::Subcontrol subControl ) const override }
{
if( subControl == QskGraphicLabel::Graphic )
{
return Graphic;
}
return subControl;
}
}; };
class MenuBarGraphicLabel final : public QskGraphicLabel class MenuBarGraphicLabel final : public QskGraphicLabel
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Graphic ) QSK_SUBCONTROLS( Graphic )
MenuBarGraphicLabel( const QskGraphic& graphic, QQuickItem* parent = nullptr ) MenuBarGraphicLabel( const QskGraphic& graphic, QQuickItem* parent = nullptr )
: QskGraphicLabel( graphic, parent ) : QskGraphicLabel( graphic, parent )
{
}
QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override
{
if( subControl == QskGraphicLabel::Graphic )
{ {
return Graphic;
} }
QskAspect::Subcontrol effectiveSubcontrol( return subControl;
QskAspect::Subcontrol subControl ) const override }
{
if( subControl == QskGraphicLabel::Graphic )
{
return Graphic;
}
return subControl;
}
}; };
class MenuBarLabel final : public QskTextLabel class MenuBarLabel final : public QskTextLabel
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Text ) QSK_SUBCONTROLS( Text )
MenuBarLabel( const QString& text, QQuickItem* parent = nullptr ) MenuBarLabel( const QString& text, QQuickItem* parent = nullptr )
: QskTextLabel( text, parent ) : QskTextLabel( text, parent )
{
}
QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override
{
if( subControl == QskTextLabel::Text )
{ {
return Text;
} }
QskAspect::Subcontrol effectiveSubcontrol( return subControl;
QskAspect::Subcontrol subControl ) const override }
{
if( subControl == QskTextLabel::Text )
{
return Text;
}
return subControl;
}
}; };
class MenuItem final : public QskLinearBox class MenuItem final : public QskLinearBox
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Panel ) QSK_SUBCONTROLS( Panel )
QSK_STATES( Active ) 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: private:
QString m_name; QString m_name;
}; };
class MenuBar final : public QskLinearBox class MenuBar final : public QskLinearBox
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Panel ) QSK_SUBCONTROLS( Panel )
MenuBar( QQuickItem* parent ); MenuBar( QQuickItem* parent );
QskAspect::Subcontrol effectiveSubcontrol( QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol ) const override; QskAspect::Subcontrol ) const override;
private: private:
QList< QString > m_entryStrings; QList< QString > m_entryStrings;
QList< MenuItem* > m_entries; QList< MenuItem* > m_entries;
uint m_activeEntry = 0; uint m_activeEntry = 0;
}; };
#endif // MENUBAR_H #endif // MENUBAR_H

View File

@ -18,49 +18,49 @@ namespace
{ {
class Device : public QskLinearBox class Device : public QskLinearBox
{ {
public: public:
Device( const QString& name, bool isBright, QQuickItem* parent ) Device( const QString& name, bool isBright, QQuickItem* parent )
: QskLinearBox( Qt::Vertical, parent ) : QskLinearBox( Qt::Vertical, parent )
, m_name( name ) , m_name( name )
{ {
setDefaultAlignment( Qt::AlignCenter ); setDefaultAlignment( Qt::AlignCenter );
setAutoAddChildren( false ); setAutoAddChildren( false );
m_icon = new RoundedIcon( QString(), isBright, true, this ); m_icon = new RoundedIcon( QString(), isBright, true, this );
m_icon->setSkinState( m_icon->skinState() | RoundedIcon::Small ); m_icon->setSkinState( m_icon->skinState() | RoundedIcon::Small );
m_icon->setOpacity( 0.15 ); m_icon->setOpacity( 0.15 );
addItem( m_icon ); addItem( m_icon );
auto* textLabel = new QskTextLabel( name, this ); auto* textLabel = new QskTextLabel( name, this );
textLabel->setFontRole( QskSkin::TinyFont ); textLabel->setFontRole( QskSkin::TinyFont );
textLabel->setAlignment( Qt::AlignHCenter ); textLabel->setAlignment( Qt::AlignHCenter );
addItem( textLabel ); addItem( textLabel );
auto fileName = name.toLower(); auto fileName = name.toLower();
fileName.replace( ' ', '-' ); fileName.replace( ' ', '-' );
fileName = ":/images/" + fileName + ".png"; fileName = ":/images/" + fileName + ".png";
QImage image( fileName ); QImage image( fileName );
auto graphic = QskGraphic::fromImage( image ); auto graphic = QskGraphic::fromImage( image );
m_graphicLabel = new QskGraphicLabel( graphic, this ); m_graphicLabel = new QskGraphicLabel( graphic, this );
} }
protected: protected:
void updateLayout() override void updateLayout() override
{ {
QskLinearBox::updateLayout(); QskLinearBox::updateLayout();
// We cannot use the icon from RoundedIcon here because // We cannot use the icon from RoundedIcon here because
// it would inherit the transparency // it would inherit the transparency
const qreal size = metric( RoundedIcon::Icon | QskAspect::Size ); const qreal size = metric( RoundedIcon::Icon | QskAspect::Size );
m_graphicLabel->setSize( {size, size} ); m_graphicLabel->setSize( {size, size} );
m_graphicLabel->setPosition( { m_icon->position().x() + ( m_icon->width() - m_graphicLabel->width() ) / 2, 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 } ); ( m_icon->position().y() + m_icon->height() - m_graphicLabel->height() ) / 2 } );
} }
private: private:
QString m_name; QString m_name;
RoundedIcon* m_icon; RoundedIcon* m_icon;
QskGraphicLabel* m_graphicLabel; QskGraphicLabel* m_graphicLabel;
}; };
} }

View File

@ -10,8 +10,8 @@
class MyDevices : public Box class MyDevices : public Box
{ {
public: public:
MyDevices( QQuickItem* parent ); MyDevices( QQuickItem* parent );
}; };
#endif // MYDEVICES_H #endif // MYDEVICES_H

View File

@ -8,7 +8,8 @@
QSK_SUBCONTROL( PieChart, Panel ) QSK_SUBCONTROL( PieChart, Panel )
QSK_SUBCONTROL( PieChart, Labels ) QSK_SUBCONTROL( PieChart, Labels )
PieChart::PieChart( QQuickItem* parent ) : QskControl( parent ) PieChart::PieChart( QQuickItem* parent )
: QskControl( parent )
{ {
} }

View File

@ -10,22 +10,22 @@
class PieChart : public QskControl class PieChart : public QskControl
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Panel, Labels ) QSK_SUBCONTROLS( Panel, Labels )
PieChart( QQuickItem* parent = nullptr ); PieChart( QQuickItem* parent = nullptr );
QVector< float > angles() const; QVector< float > angles() const;
void setAngles( const QVector< float >& angles ); void setAngles( const QVector< float >& angles );
QVector< QString > labels() const; QVector< QString > labels() const;
void setLabels( const QVector< QString >& labels ); void setLabels( const QVector< QString >& labels );
private: private:
QVector< float > m_angles; QVector< float > m_angles;
QVector< QString > m_labels; QVector< QString > m_labels;
}; };
#endif // PIECHART_H #endif // PIECHART_H

View File

@ -32,51 +32,51 @@ namespace
// ### There must be an easier way to do this // ### There must be an easier way to do this
class ProgressBarAnimator : public QskAnimator class ProgressBarAnimator : public QskAnimator
{ {
public: public:
ProgressBarAnimator( PieChartPainted* pieChart, CircularProgressBar* progressBar ) ProgressBarAnimator( PieChartPainted* pieChart, CircularProgressBar* progressBar )
: m_pieChart( pieChart ) : m_pieChart( pieChart )
, m_progressBar( progressBar ) , 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<QQuickWindow*>( qGuiApp->allWindows().at( 0 ) ); QColor c = stop.second;
setWindow( w ); QColor c2 = invertedColor( c );
setDuration( 500 ); const QColor newColor = QskRgb::interpolated( c, c2, value );
setEasingCurve( QEasingCurve::Linear ); newGradient.setColorAt( stop.first, newColor );
setAutoRepeat( false );
} }
void setup() override m_progressBar->setRingGradient( newGradient );
{ m_progressBar->update();
m_backgroundColor = m_pieChart->color( PieChartPainted::Panel ); }
m_ringGradient = m_progressBar->ringGradient();
}
void advance( qreal value ) override private:
{ QColor m_backgroundColor;
const QColor c = m_backgroundColor; QRadialGradient m_ringGradient;
const QColor c2 = invertedColor( c ); PieChartPainted* m_pieChart;
const QColor newColor = QskRgb::interpolated( c2, c, value ); CircularProgressBar* m_progressBar;
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;
}; };
PieChartPainted::PieChartPainted( const QColor& color, const QskGradient& gradient, int progress, int /*value*/, QQuickItem* parent ) PieChartPainted::PieChartPainted( const QColor& color, const QskGradient& gradient, int progress, int /*value*/, QQuickItem* parent )

View File

@ -17,23 +17,23 @@ class QQuickPaintedItem;
class PieChartPainted : public QskControl class PieChartPainted : public QskControl
{ {
public: public:
QSK_SUBCONTROLS( Panel ) 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 effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override final; QskAspect::Subcontrol subControl ) const override final;
virtual QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override; virtual QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
void updateLayout() override; void updateLayout() override;
private: private:
QColor m_color; QColor m_color;
QskGradient m_gradient; QskGradient m_gradient;
CircularProgressBar* m_progressBar; CircularProgressBar* m_progressBar;
QskTextLabel* m_progressLabel; QskTextLabel* m_progressLabel;
ProgressBarAnimator* m_animator; ProgressBarAnimator* m_animator;
}; };
#endif // PIECHARTPAINTED_H #endif // PIECHARTPAINTED_H

View File

@ -11,7 +11,8 @@
#include <QskBoxBorderMetrics.h> #include <QskBoxBorderMetrics.h>
#include <QskBoxBorderColors.h> #include <QskBoxBorderColors.h>
PieChartSkinlet::PieChartSkinlet( QskSkin* skin ) : QskSkinlet( skin ) PieChartSkinlet::PieChartSkinlet( QskSkin* skin )
: QskSkinlet( skin )
{ {
setNodeRoles( { PanelRole, LabelsRole } ); setNodeRoles( { PanelRole, LabelsRole } );
} }

View File

@ -12,25 +12,25 @@ class PieChart;
class PieChartSkinlet : public QskSkinlet class PieChartSkinlet : public QskSkinlet
{ {
Q_GADGET Q_GADGET
public: public:
enum NodeRole enum NodeRole
{ {
PanelRole, PanelRole,
LabelsRole 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: protected:
virtual QSGNode* updateSubNode( const QskSkinnable*, quint8 nodeRole, QSGNode* node ) const override; virtual QSGNode* updateSubNode( const QskSkinnable*, quint8 nodeRole, QSGNode* node ) const override;
private: private:
QSGNode* updatePanelNode( const PieChart*, QSGNode* ) const; QSGNode* updatePanelNode( const PieChart*, QSGNode* ) const;
QSGNode* updateLabelsNode( const PieChart*, QSGNode* ) const; QSGNode* updateLabelsNode( const PieChart*, QSGNode* ) const;
}; };
#endif // PIECHART_SKINLET_H #endif // PIECHART_SKINLET_H

View File

@ -13,32 +13,33 @@ class QskGraphicLabel;
class RoundedIcon : public QskBox class RoundedIcon : public QskBox
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Panel, Icon ) QSK_SUBCONTROLS( Panel, Icon )
QSK_STATES( Bright, Small ) // to differentiate between orange and purple and small vs. big 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 effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override QskAspect::Subcontrol subControl ) const override
{
if( subControl == QskBox::Panel )
{ {
if( subControl == QskBox::Panel ) return Panel;
{
return Panel;
}
return subControl;
} }
protected: return subControl;
void updateLayout() override; }
virtual QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
private: protected:
QString m_iconName; void updateLayout() override;
QskGraphicLabel* m_graphicLabel = nullptr; virtual QSizeF contentsSizeHint( Qt::SizeHint, const QSizeF& ) const override;
private:
QString m_iconName;
QskGraphicLabel* m_graphicLabel = nullptr;
}; };
#endif // ROUNDEDICON_H #endif // ROUNDEDICON_H

View File

@ -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 >(); declareSkinlet< Diagram, DiagramSkinlet >();

View File

@ -11,71 +11,72 @@
class Skin : public QskSkin class Skin : public QskSkin
{ {
public: public:
class Palette 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, QskGradient menuBar;
const QColor& lightDisplay, const QColor& pieChart, const QskGradient& roundButton, QskGradient mainContent;
const QColor& weekdayBox, const QColor& text, const QColor& shadow ) QskGradient box;
: menuBar( menuBar ) QColor lightDisplay;
, mainContent( mainContent ) QColor pieChart;
, box( box ) QskGradient roundButton;
, lightDisplay( lightDisplay ) QColor weekdayBox;
, pieChart( pieChart ) QColor text;
, roundButton( roundButton ) QColor shadow;
, weekdayBox( weekdayBox ) };
, text( text )
, shadow( 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 ); Skin( const Palette& palette, QObject* parent = nullptr );
virtual ~Skin(); ~Skin() override;
enum SkinFontRole enum SkinFontRole
{ {
TitleFont = QskSkin::HugeFont + 1, TitleFont = QskSkin::HugeFont + 1,
}; };
private: private:
void initHints( const Palette& palette ); void initHints( const Palette& palette );
}; };
class DaytimeSkin : public Skin class DaytimeSkin : public Skin
{ {
public: public:
DaytimeSkin( QObject* parent = nullptr ) DaytimeSkin( QObject* parent = nullptr )
: Skin( : Skin(
Skin::Palette( {"#6D7BFB"}, {"#fbfbfb"}, {"#ffffff"}, Skin::Palette( {"#6D7BFB"}, {"#fbfbfb"}, {"#ffffff"},
"#ffffff", "#ffffff", {"#f7f7f7"}, "#ffffff", "#ffffff", {"#f7f7f7"},
{"#f4f4f4"}, Qt::black, Qt::black ) {"#f4f4f4"}, Qt::black, Qt::black )
, parent ) , parent )
{ {
} }
}; };
class NighttimeSkin : public Skin class NighttimeSkin : public Skin
{ {
public: public:
NighttimeSkin( QObject* parent = nullptr ) NighttimeSkin( QObject* parent = nullptr )
: Skin( : Skin(
Skin::Palette( {"#2937A7"}, {"#040404"}, {"#000000"}, Skin::Palette( {"#2937A7"}, {"#040404"}, {"#000000"},
"#000000", "#000000", {"#0a0a0a"}, "#000000", "#000000", {"#0a0a0a"},
{"#0c0c0c"}, Qt::white, Qt::white ) {"#0c0c0c"}, Qt::white, Qt::white )
, parent ) , parent )
{ {
} }
}; };
#endif // SKIN_H #endif // SKIN_H

View File

@ -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 ); setPanel( true );
setAutoLayoutChildren( true ); setAutoLayoutChildren( true );

View File

@ -13,98 +13,98 @@
class TimeTitleLabel : public QskTextLabel class TimeTitleLabel : public QskTextLabel
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Text ) QSK_SUBCONTROLS( Text )
TimeTitleLabel( const QString& text, QQuickItem* parent = nullptr ) TimeTitleLabel( const QString& text, QQuickItem* parent = nullptr )
: QskTextLabel( text, parent ) : QskTextLabel( text, parent )
{
}
QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override final
{
if( subControl == QskTextLabel::Text )
{ {
return Text;
} }
QskAspect::Subcontrol effectiveSubcontrol( return subControl;
QskAspect::Subcontrol subControl ) const override final }
{
if( subControl == QskTextLabel::Text )
{
return Text;
}
return subControl;
}
}; };
class TimeLabel : public QskTextLabel class TimeLabel : public QskTextLabel
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Text ) QSK_SUBCONTROLS( Text )
TimeLabel( const QString& text, QQuickItem* parent = nullptr ) TimeLabel( const QString& text, QQuickItem* parent = nullptr )
: QskTextLabel( text, parent ) : QskTextLabel( text, parent )
{
}
QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override final
{
if( subControl == QskTextLabel::Text )
{ {
return Text;
} }
QskAspect::Subcontrol effectiveSubcontrol( return subControl;
QskAspect::Subcontrol subControl ) const override final }
{
if( subControl == QskTextLabel::Text )
{
return Text;
}
return subControl;
}
}; };
class TopBarItem : public QskLinearBox class TopBarItem : public QskLinearBox
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Item1, Item2, Item3, Item4 ) 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 effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override final QskAspect::Subcontrol subControl ) const override final
{
if( subControl == QskLinearBox::Panel )
{ {
if( subControl == QskLinearBox::Panel ) return Panel;
{
return Panel;
}
return subControl;
} }
private: return subControl;
QString m_name; }
private:
QString m_name;
}; };
class TopBar : public QskLinearBox class TopBar : public QskLinearBox
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Panel ) QSK_SUBCONTROLS( Panel )
TopBar( QQuickItem* parent ); TopBar( QQuickItem* parent );
QskAspect::Subcontrol effectiveSubcontrol( QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override final QskAspect::Subcontrol subControl ) const override final
{
if( subControl == QskLinearBox::Panel )
{ {
if( subControl == QskLinearBox::Panel ) return Panel;
{
return Panel;
}
return subControl;
} }
private: return subControl;
QList< TopBarItem* > m_entries; }
private:
QList< TopBarItem* > m_entries;
}; };
#endif #endif

View File

@ -11,24 +11,24 @@
class RoundButton : QskPushButton class RoundButton : QskPushButton
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Panel ) QSK_SUBCONTROLS( Panel )
QSK_STATES( Top ) QSK_STATES( Top )
RoundButton( QskAspect::Placement placement, QQuickItem* parent ); RoundButton( QskAspect::Placement placement, QQuickItem* parent );
QskAspect::Subcontrol effectiveSubcontrol( QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override final; QskAspect::Subcontrol subControl ) const override final;
}; };
class UpAndDownButton : public QskLinearBox class UpAndDownButton : public QskLinearBox
{ {
Q_OBJECT Q_OBJECT
public: public:
UpAndDownButton( QQuickItem* parent ); UpAndDownButton( QQuickItem* parent );
}; };
#endif // UPANDDOWNBUTTON_H #endif // UPANDDOWNBUTTON_H

View File

@ -13,32 +13,32 @@
class UsageSpacer : public QskTextLabel class UsageSpacer : public QskTextLabel
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Text ) QSK_SUBCONTROLS( Text )
UsageSpacer( QQuickItem* parent = nullptr ) UsageSpacer( QQuickItem* parent = nullptr )
: QskTextLabel( "_____", parent ) : QskTextLabel( "_____", parent )
{
}
QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override final
{
if( subControl == QskTextLabel::Text )
{ {
return Text;
} }
QskAspect::Subcontrol effectiveSubcontrol( return subControl;
QskAspect::Subcontrol subControl ) const override final }
{
if( subControl == QskTextLabel::Text )
{
return Text;
}
return subControl;
}
}; };
class Usage : public Box class Usage : public Box
{ {
public: public:
Usage( QQuickItem* parent ); Usage( QQuickItem* parent );
}; };
#endif // USAGE_H #endif // USAGE_H

View File

@ -78,7 +78,7 @@ UsageDiagram::UsageDiagram( QQuickItem* parent )
// These values are calculated with a boost::math::cubic_b_spline. // These values are calculated with a boost::math::cubic_b_spline.
// We just output the values here to get rid of the dependency: // We just output the values here to get rid of the dependency:
std::vector< std::vector<qreal> > 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}, {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}, {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]; auto y = yValues[i];
QVector<QPointF> dataPoints; QVector< QPointF > dataPoints;
dataPoints.reserve( number ); dataPoints.reserve( number );
for( int x = 0; x < number; ++x ) for( int x = 0; x < number; ++x )

View File

@ -18,140 +18,144 @@ class QskGridBox;
class WeekdayLabel : public QskTextLabel class WeekdayLabel : public QskTextLabel
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Panel, Text ) 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( if( subControl == QskTextLabel::Text )
QskAspect::Subcontrol subControl ) const override final
{ {
if( subControl == QskTextLabel::Panel ) return Text;
{
return Panel;
}
if( subControl == QskTextLabel::Text )
{
return Text;
}
return subControl;
} }
return subControl;
}
}; };
class WeekdayBox : public QskBox class WeekdayBox : public QskBox
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Panel ) 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( return subControl;
QskAspect::Subcontrol subControl ) const override final }
{
if( subControl == QskBox::Panel )
{
return WeekdayBox::Panel;
}
return subControl;
}
}; };
class CaptionColorBox : public QskBox class CaptionColorBox : public QskBox
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Panel ) 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( return subControl;
QskAspect::Subcontrol subControl ) const override final }
{
if( subControl == QskBox::Panel )
{
return Panel;
}
return subControl;
}
}; };
class CaptionItem : public QskLinearBox class CaptionItem : public QskLinearBox
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Panel ) QSK_SUBCONTROLS( Panel )
QSK_STATES( Water, Electricity, Gas ) QSK_STATES( Water, Electricity, Gas )
CaptionItem( QskAspect::State state, QQuickItem* parent ); CaptionItem( QskAspect::State state, QQuickItem* parent );
}; };
class CaptionBox : public QskLinearBox class CaptionBox : public QskLinearBox
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Panel ) 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( return subControl;
QskAspect::Subcontrol subControl ) const override final }
{
if( subControl == QskBox::Panel )
{
return Panel;
}
return subControl;
}
}; };
class UsageDiagram : public Box class UsageDiagram : public Box
{ {
Q_OBJECT Q_OBJECT
public: public:
QSK_SUBCONTROLS( Panel ) QSK_SUBCONTROLS( Panel )
UsageDiagram( QQuickItem* parent ); UsageDiagram( QQuickItem* parent );
void updateLayout() override; void updateLayout() override;
QskAspect::Subcontrol effectiveSubcontrol( QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override final QskAspect::Subcontrol subControl ) const override final
{
if( subControl == QskBox::Panel )
{ {
if( subControl == QskBox::Panel ) return Panel;
{
return Panel;
}
return subControl;
} }
private: return subControl;
Diagram* m_diagram; }
QskLinearBox* m_captionBox;
QskGridBox* m_weekdays; private:
Diagram* m_diagram;
QskLinearBox* m_captionBox;
QskGridBox* m_weekdays;
}; };
#endif // USAGEDIAGRAM_H #endif // USAGEDIAGRAM_H

View File

@ -25,32 +25,33 @@ namespace
{ {
class SkinFactory : public QskSkinFactory class SkinFactory : public QskSkinFactory
{ {
Q_OBJECT Q_OBJECT
public: public:
SkinFactory( QObject* parent = nullptr ) : QskSkinFactory( parent ) 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 return nullptr;
{ }
if( skinName == "DaytimeSkin" )
{
return new DaytimeSkin;
}
if( skinName == "NighttimeSkin" )
{
return new NighttimeSkin;
}
return nullptr;
}
}; };
} }
@ -79,7 +80,7 @@ int main( int argc, char* argv[] )
// With CTRL-B you can rotate a couple of visual debug modes // With CTRL-B you can rotate a couple of visual debug modes
SkinnyShortcut::enable( SkinnyShortcut::RotateSkin | SkinnyShortcut::DebugBackground | SkinnyShortcut::enable( SkinnyShortcut::RotateSkin | SkinnyShortcut::DebugBackground |
SkinnyShortcut::DebugStatistics | SkinnyShortcut::Quit ); SkinnyShortcut::DebugStatistics | SkinnyShortcut::Quit );
MainWindow window; MainWindow window;
window.show(); window.show();

View File

@ -14,8 +14,9 @@ DiagramDataNode::DiagramDataNode()
setMaterial( &m_material ); setMaterial( &m_material );
} }
void DiagramDataNode::update( const QRectF& rect, Type type, const QColor& color, const QVector<QPointF>& dataPoints, void DiagramDataNode::update( const QRectF& rect, Type type,
const qreal yMax, Qsk::Position position, int lineWidth ) const QColor& color, const QVector< QPointF >& dataPoints,
const qreal yMax, Qsk::Position position, int lineWidth )
{ {
Q_UNUSED( rect ); Q_UNUSED( rect );
@ -65,7 +66,7 @@ void DiagramDataNode::update( const QRectF& rect, Type type, const QColor& color
if( m_dataPoints.count() > 0 ) 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(); xMax = m_dataPoints.at( m_dataPoints.count() - 1 ).x();
} }
else else

View File

@ -14,28 +14,28 @@
class DiagramDataNode : public QSGGeometryNode class DiagramDataNode : public QSGGeometryNode
{ {
public: public:
enum Type enum Type
{ {
Line, Line,
Area, Area,
}; };
DiagramDataNode(); DiagramDataNode();
void update( const QRectF& rect, Type type, const QColor& color, const QVector<QPointF>& 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: private:
QSGFlatColorMaterial m_material; QSGFlatColorMaterial m_material;
QSGGeometry m_geometry; QSGGeometry m_geometry;
QRectF m_rect; QRectF m_rect;
Type m_type; Type m_type;
QColor m_color; QColor m_color;
QVector<QPointF> m_dataPoints; QVector< QPointF > m_dataPoints;
qreal m_yMax; qreal m_yMax;
Qsk::Position m_position; Qsk::Position m_position;
int m_lineWidth; int m_lineWidth;
}; };
#endif #endif

View File

@ -20,7 +20,8 @@ DiagramSegmentsNode::DiagramSegmentsNode()
setMaterial( &m_material ); setMaterial( &m_material );
} }
void DiagramSegmentsNode::update( const QRectF& rect, const QColor& color, const QVector<QVector<QPointF> >& dataPoints, int xGridLines ) void DiagramSegmentsNode::update( const QRectF& rect, const QColor& color,
const QVector< QVector< QPointF > >& dataPoints, int xGridLines )
{ {
Q_UNUSED( rect ); Q_UNUSED( rect );

View File

@ -12,19 +12,19 @@
class DiagramSegmentsNode : public QSGGeometryNode class DiagramSegmentsNode : public QSGGeometryNode
{ {
public: public:
DiagramSegmentsNode(); DiagramSegmentsNode();
void update( const QRectF& rect, const QColor& color, const QVector< QVector<QPointF> >& dataPoints, int xGridLines ); void update( const QRectF& rect, const QColor& color, const QVector< QVector< QPointF > >& dataPoints, int xGridLines );
private: private:
QSGFlatColorMaterial m_material; QSGFlatColorMaterial m_material;
QSGGeometry m_geometry; QSGGeometry m_geometry;
QRectF m_rect; QRectF m_rect;
QColor m_color; QColor m_color;
QVector< QVector<QPointF> > m_dataPoints; QVector< QVector< QPointF > > m_dataPoints;
int m_xGridLines; int m_xGridLines;
}; };
#endif #endif

View File

@ -374,13 +374,13 @@ inline void QskAspect::setPrimitive( Type type, QskAspect::Primitive primitive )
inline constexpr QskAspect::Primitive QskAspect::flagPrimitive() const noexcept inline constexpr QskAspect::Primitive QskAspect::flagPrimitive() const noexcept
{ {
return ( m_bits.type == Flag ) 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 inline constexpr QskAspect::Primitive QskAspect::colorPrimitive() const noexcept
{ {
return ( m_bits.type == Color ) 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 inline constexpr QskAspect::Primitive QskAspect::metricPrimitive() const noexcept

View File

@ -48,7 +48,7 @@ class QSK_EXPORT QskEvent : public QEvent
QskEvent( QskEvent::Type type ); QskEvent( QskEvent::Type type );
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) #if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
virtual QskEvent *clone() const; virtual QskEvent* clone() const;
#endif #endif
}; };

View File

@ -694,7 +694,7 @@ bool qskGrabMouse( QQuickItem* item )
stored depending on these attributes the following stored depending on these attributes the following
mouse event callbacks will look for the grabber at a mouse event callbacks will look for the grabber at a
a different place as it was stored. a different place as it was stored.
*/ */
if ( const auto event = qskPointerPressEvent( wd ) ) if ( const auto event = qskPointerPressEvent( wd ) )
{ {

View File

@ -82,7 +82,7 @@ void QskSkinHintTableEditor::setFlag( QskAspect aspect, int flag )
int QskSkinHintTableEditor::flag( QskAspect aspect ) const int QskSkinHintTableEditor::flag( QskAspect aspect ) const
{ {
return flagHint<int>( aspect ); return flagHint< int >( aspect );
} }
void QskSkinHintTableEditor::setMetric( QskAspect aspect, qreal metric ) void QskSkinHintTableEditor::setMetric( QskAspect aspect, qreal metric )
@ -92,7 +92,7 @@ void QskSkinHintTableEditor::setMetric( QskAspect aspect, qreal metric )
qreal QskSkinHintTableEditor::metric( QskAspect aspect ) const qreal QskSkinHintTableEditor::metric( QskAspect aspect ) const
{ {
return metricHint<qreal>( aspect ); return metricHint< qreal >( aspect );
} }
void QskSkinHintTableEditor::setColor( QskAspect aspect, Qt::GlobalColor color ) 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 QColor QskSkinHintTableEditor::color( QskAspect aspect ) const
{ {
return colorHint<QColor>( aspect ); return colorHint< QColor >( aspect );
} }
void QskSkinHintTableEditor::setHGradient( void QskSkinHintTableEditor::setHGradient(
@ -134,7 +134,7 @@ void QskSkinHintTableEditor::setGradient( QskAspect aspect, const QskGradient& g
QskGradient QskSkinHintTableEditor::gradient( QskAspect aspect ) const QskGradient QskSkinHintTableEditor::gradient( QskAspect aspect ) const
{ {
return colorHint<QskGradient>( aspect ); return colorHint< QskGradient >( aspect );
} }
void QskSkinHintTableEditor::setStrutSize( QskAspect aspect, const QSizeF& size ) void QskSkinHintTableEditor::setStrutSize( QskAspect aspect, const QSizeF& size )

View File

@ -56,7 +56,7 @@ static inline QVariant qskTypedNullValue( const QVariant& value )
} }
static inline bool qskSetFlag( QskSkinnable* skinnable, static inline bool qskSetFlag( QskSkinnable* skinnable,
const QskAspect aspect, int flag ) const QskAspect aspect, int flag )
{ {
return skinnable->setSkinHint( aspect | QskAspect::Flag, QVariant( 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, 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 ); return skinnable->setSkinHint( aspect | QskAspect::Metric, metric );
} }
@ -553,7 +553,7 @@ QskColorFilter QskSkinnable::effectiveGraphicFilter( QskAspect aspect ) const
if ( auto control = owningControl() ) if ( auto control = owningControl() )
{ {
v = QskSkinTransition::animatedGraphicFilter( v = QskSkinTransition::animatedGraphicFilter(
control->window(), hint.toInt() ); control->window(), hint.toInt() );
if ( v.canConvert< QskColorFilter >() ) if ( v.canConvert< QskColorFilter >() )
{ {

View File

@ -54,7 +54,7 @@ class QskStatusIndicator::PrivateData
int currentStatus; int currentStatus;
QMap< int, StatusData > map; QMap< int, StatusData > map;
mutable QList<int> statusList; mutable QList< int > statusList;
}; };
QskStatusIndicator::QskStatusIndicator( QQuickItem* parent ) QskStatusIndicator::QskStatusIndicator( QQuickItem* parent )
@ -211,7 +211,7 @@ void QskStatusIndicator::setStatus( int status )
update(); update();
} }
QList<int> QskStatusIndicator::statusList() const QList< int > QskStatusIndicator::statusList() const
{ {
/* /*
We should be have a QMap< int, QskGraphic >, so that We should be have a QMap< int, QskGraphic >, so that

View File

@ -449,7 +449,7 @@ int QskTabBar::insertTab( int index, QskTabButton* button )
m_data->connectButton( button, this, true ); m_data->connectButton( button, this, true );
connect( button, &QskAbstractButton::clicked, connect( button, &QskAbstractButton::clicked,
this, &QskTabBar::handleButtonClick ); this, &QskTabBar::handleButtonClick );
Q_EMIT countChanged( count() ); Q_EMIT countChanged( count() );

View File

@ -15,7 +15,7 @@
QSK_SUBCONTROL( QskTabButton, Panel ) QSK_SUBCONTROL( QskTabButton, Panel )
QSK_SUBCONTROL( QskTabButton, Text ) QSK_SUBCONTROL( QskTabButton, Text )
static inline QskTabBar* qskFindTabBar( QskTabButton* button ) static inline QskTabBar* qskFindTabBar( const QskTabButton* button )
{ {
return qskFindAncestorOf< QskTabBar* >( button->parentItem() ); return qskFindAncestorOf< QskTabBar* >( button->parentItem() );
} }

View File

@ -18,8 +18,7 @@ namespace
class TextInputProxy final : public QskTextInput class TextInputProxy final : public QskTextInput
{ {
public: public:
TextInputProxy( QskInputPanelBox* panelBox, TextInputProxy( QskInputPanelBox* panelBox, QQuickItem* parentItem = nullptr )
QQuickItem* parentItem = nullptr )
: QskTextInput( parentItem ) : QskTextInput( parentItem )
, m_panelBox( panelBox ) , m_panelBox( panelBox )
{ {

View File

@ -496,8 +496,8 @@ void QskGridBox::dump() const
const auto constraint = sizeConstraint(); const auto constraint = sizeConstraint();
debug << "QskGridBox" debug << "QskGridBox"
<< "[" << engine.columnCount() << "," << engine.rowCount() << "] w:" << "[" << engine.columnCount() << "," << engine.rowCount() << "] w:"
<< constraint.width() << " h:" << constraint.height() << '\n'; << constraint.width() << " h:" << constraint.height() << '\n';
for ( int i = 0; i < engine.count(); i++ ) for ( int i = 0; i < engine.count(); i++ )
{ {
@ -521,7 +521,7 @@ void QskGridBox::dump() const
const auto constraint = qskSizeConstraint( item, Qt::PreferredSize ); const auto constraint = qskSizeConstraint( item, Qt::PreferredSize );
debug << item->metaObject()->className() debug << item->metaObject()->className()
<< " w:" << constraint.width() << " h:" << constraint.height(); << " w:" << constraint.width() << " h:" << constraint.height();
} }
else else
{ {

View File

@ -541,7 +541,7 @@ void QskLinearBox::dump() const
const auto constraint = sizeConstraint(); const auto constraint = sizeConstraint();
debug << "QskLinearBox" << engine.orientation() 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++ ) for ( int i = 0; i < engine.count(); i++ )
{ {
@ -551,7 +551,7 @@ void QskLinearBox::dump() const
{ {
const auto constraint = qskSizeConstraint( item, Qt::PreferredSize ); const auto constraint = qskSizeConstraint( item, Qt::PreferredSize );
debug << item->metaObject()->className() debug << item->metaObject()->className()
<< " w:" << constraint.width() << " h:" << constraint.height(); << " w:" << constraint.width() << " h:" << constraint.height();
} }
else else
{ {

View File

@ -427,7 +427,7 @@ void QskStackBox::dump() const
const auto constraint = sizeConstraint(); const auto constraint = sizeConstraint();
debug << "QskStackBox" 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++ ) 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 ); const auto constraint = qskSizeConstraint( item, Qt::PreferredSize );
debug << item->metaObject()->className() debug << item->metaObject()->className()
<< " w:" << constraint.width() << " h:" << constraint.height(); << " w:" << constraint.width() << " h:" << constraint.height();
if ( i == m_data->currentIndex ) if ( i == m_data->currentIndex )
debug << " [X]"; debug << " [X]";

View File

@ -251,7 +251,7 @@ void SkinnyShortcut::debugStatistics()
countItems( w->contentItem(), counter ); countItems( w->contentItem(), counter );
qDebug() << w << "\n\titems:" << counter[0] << "visible" << counter[1] qDebug() << w << "\n\titems:" << counter[0] << "visible" << counter[1]
<< "\n\tnodes:" << counter[2] << "visible" << counter[3]; << "\n\tnodes:" << counter[2] << "visible" << counter[3];
} }
} }