diff --git a/examples/iot-dashboard/MenuBar.cpp b/examples/iot-dashboard/MenuBar.cpp index ad3742f7..d6b4fc36 100644 --- a/examples/iot-dashboard/MenuBar.cpp +++ b/examples/iot-dashboard/MenuBar.cpp @@ -8,6 +8,7 @@ #include +QSK_SUBCONTROL( MenuBarLabel, Text ) QSK_SUBCONTROL( MenuItem, Panel ) MenuItem::MenuItem( const QString& name, QQuickItem* parent ) : QskLinearBox( Qt::Horizontal, parent ), @@ -29,9 +30,7 @@ MenuItem::MenuItem( const QString& name, QQuickItem* parent ) : QskLinearBox( Qt graphicLabel->setFixedWidth( 14 ); graphicLabel->setAlignment( Qt::AlignCenter ); - auto* textLabel = new QskTextLabel( name, this ); - textLabel->setTextColor( Qt::white ); // ### style - textLabel->setFontRole( QskSkin::SmallFont ); // ### style + new MenuBarLabel( name, this ); } QskAspect::Subcontrol MenuItem::effectiveSubcontrol( QskAspect::Subcontrol subControl ) const diff --git a/examples/iot-dashboard/MenuBar.h b/examples/iot-dashboard/MenuBar.h index 3d23d1f0..33708cc1 100644 --- a/examples/iot-dashboard/MenuBar.h +++ b/examples/iot-dashboard/MenuBar.h @@ -2,6 +2,31 @@ #define MENUBAR_H #include +#include + +class MenuBarLabel : public QskTextLabel +{ + Q_OBJECT + + public: + QSK_SUBCONTROLS( Text ) + + MenuBarLabel( const QString& text, QQuickItem* parent = nullptr ) + : QskTextLabel( text, parent ) + { + } + + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final + { + if( subControl == QskTextLabel::Text ) + { + return Text; + } + + return subControl; + } +}; class MenuItem : public QskLinearBox { diff --git a/examples/iot-dashboard/Skin.cpp b/examples/iot-dashboard/Skin.cpp index abc334ba..dcd23e78 100644 --- a/examples/iot-dashboard/Skin.cpp +++ b/examples/iot-dashboard/Skin.cpp @@ -69,6 +69,9 @@ void Skin::initHints( const Palette& palette ) color.setAlphaF( 0.09 ); ed.setGradient( MenuItem::Panel | QskControl::Hovered, color ); + ed.setColor( MenuBarLabel::Text, Qt::white ); + ed.setFontRole( MenuBarLabel::Text, QskSkin::SmallFont ); + ed.setGradient( MenuBar::Panel, palette.menuBar ); ed.setGradient( MainContent::Panel, palette.mainContent );