diff --git a/examples/iot-dashboard/Diagram.cpp b/examples/iot-dashboard/Diagram.cpp index af799c4f..653ba6e6 100644 --- a/examples/iot-dashboard/Diagram.cpp +++ b/examples/iot-dashboard/Diagram.cpp @@ -14,43 +14,22 @@ QSK_SUBCONTROL( WeekdayBox, Panel ) -WeekdayBox::WeekdayBox( QQuickItem* parent ) - : QskBox( true, parent ) +CaptionItem::CaptionItem( const QColor& color, const QString& text, QQuickItem* parent ) + : QskLinearBox( Qt::Horizontal, parent ) { - setBoxBorderMetricsHint( WeekdayBox::Panel, {0, 0, 3, 3} ); -} + setSpacing( 10 ); + auto* box = new QskBox( true, this ); + box->setGradientHint( QskBox::Panel, color ); -QskAspect::Subcontrol WeekdayBox::effectiveSubcontrol( QskAspect::Subcontrol subControl ) const -{ - if( subControl == QskBox::Panel ) - { - return WeekdayBox::Panel; - } + auto* textLabel = new QskTextLabel( text, this ); + textLabel->setFontRole( QskSkin::TinyFont ); - return subControl; + box->setFixedSize( 8, 8 ); + box->setBoxShapeHint( QskBox::Panel, 4 ); } namespace { - class CaptionItem : public QskLinearBox - { - Q_OBJECT - public: - CaptionItem( const QColor& color, const QString& text, QQuickItem* parent ) - : QskLinearBox( Qt::Horizontal, parent ) - { - setSpacing( 10 ); - auto* box = new QskBox( true, this ); - box->setGradientHint( QskBox::Panel, color ); - - auto* textLabel = new QskTextLabel( text, this ); - textLabel->setFontRole( QskSkin::TinyFont ); - - box->setFixedSize( 8, 8 ); - box->setBoxShapeHint( QskBox::Panel, 4 ); - } - }; - float distance( const QPointF& pt1, const QPointF& pt2 ) { diff --git a/examples/iot-dashboard/Diagram.h b/examples/iot-dashboard/Diagram.h index 199492cf..4f6f000b 100644 --- a/examples/iot-dashboard/Diagram.h +++ b/examples/iot-dashboard/Diagram.h @@ -15,10 +15,27 @@ class WeekdayBox : public QskBox public: QSK_SUBCONTROLS( Panel ) - WeekdayBox( QQuickItem* parent ); + WeekdayBox( QQuickItem* parent ) : QskBox( true, parent ) + { + } QskAspect::Subcontrol effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const override final; + QskAspect::Subcontrol subControl ) const override final + { + if( subControl == QskBox::Panel ) + { + return WeekdayBox::Panel; + } + + return subControl; + } +}; + +class CaptionItem : public QskLinearBox +{ + Q_OBJECT + public: + CaptionItem( const QColor& color, const QString& text, QQuickItem* parent ); }; class Diagram : public Box diff --git a/examples/iot-dashboard/Skin.cpp b/examples/iot-dashboard/Skin.cpp index 33bdaa22..e893add4 100644 --- a/examples/iot-dashboard/Skin.cpp +++ b/examples/iot-dashboard/Skin.cpp @@ -109,6 +109,9 @@ void Skin::initHints( const Palette& palette ) ed.setMetric( RoundedIcon::Panel | RoundedIcon::Small | QskAspect::Size, 60 ); ed.setMetric( RoundedIcon::Icon | QskAspect::Size, 36 ); + // diagram: + ed.setBoxBorderMetrics( WeekdayBox::Panel, {0, 0, 3, 3} ); + // palette dependent skin hints: ed.setGradient( MenuBar::Panel, palette.menuBar ); ed.setGradient( MainContent::Panel, palette.mainContent );