diff --git a/examples/iot-dashboard/DaytimeSkin.cpp b/examples/iot-dashboard/DaytimeSkin.cpp index 6b6915b6..59929c47 100644 --- a/examples/iot-dashboard/DaytimeSkin.cpp +++ b/examples/iot-dashboard/DaytimeSkin.cpp @@ -57,6 +57,14 @@ void DaytimeSkin::initHints() QskSkinHintTableEditor ed( &hintTable() ); + ed.setPadding( MenuBar::Panel, {0, 35, 0, 12} ); + ed.setGradient( MenuBar::Panel, {"#6D7BFB"} ); + + ed.setPadding( MenuItem::Panel, {30, 0, 30, 0} ); + QColor color( Qt::white ); + color.setAlphaF( 0.09 ); + ed.setGradient( MenuItem::Panel | QskControl::Hovered, color ); + ed.setGradient( MainContent::Panel, {"#fbfbfb"} ); ed.setGradient( Box::Panel, {"#ffffff"} ); ed.setColor( LightDisplay::Panel, "#ffffff" ); @@ -65,7 +73,4 @@ void DaytimeSkin::initHints() ed.setBoxBorderColors( WeekdayBox::Panel, {"#f4f4f4"} ); ed.setColor( QskTextLabel::Text, "#000000" ); - QColor color( Qt::white ); - color.setAlphaF( 0.09 ); - ed.setGradient( MenuItem::Panel | QskControl::Hovered, color ); } diff --git a/examples/iot-dashboard/MenuBar.cpp b/examples/iot-dashboard/MenuBar.cpp index e5b7ee2a..f9fb27ef 100644 --- a/examples/iot-dashboard/MenuBar.cpp +++ b/examples/iot-dashboard/MenuBar.cpp @@ -16,8 +16,6 @@ MenuItem::MenuItem( const QString& name, QQuickItem* parent ) : QskLinearBox( Qt setAutoLayoutChildren( true ); setAutoAddChildren( true ); setFixedSize( {140, 40} ); - setMargins( {0, 0, 0, 0} ); - setPadding( {30, 0, 30, 0} ); setSpacing( 6 ); setAcceptHoverEvents( true ); @@ -64,15 +62,13 @@ void MenuItem::setActive( bool active ) } +QSK_SUBCONTROL( MenuBar, Panel ) + MenuBar::MenuBar( QQuickItem* parent ) : QskLinearBox( Qt::Vertical, parent ) { + setPanel( true ); setSizePolicy( QskSizePolicy::Minimum, QskSizePolicy::Preferred ); - setAutoLayoutChildren( true ); - setAutoAddChildren( true ); setSpacing( 8 ); - setMargins( {0, 35, 0, 12} ); - - setBackgroundColor( "#6D7BFB" ); // ### style auto* mainIcon = ":/images/main-icon.png"; QImage image( mainIcon ); @@ -82,10 +78,9 @@ MenuBar::MenuBar( QQuickItem* parent ) : QskLinearBox( Qt::Vertical, parent ) graphicLabel->setMargins( { 50, 0, 50, 54 } ); graphicLabel->setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed ); - m_entryStrings = { "Dashboard", "Rooms", "Devices", "Statistics", "Storage", "Members" }; - for( const auto& entryString : m_entryStrings ) + for( const auto& entryString : qAsConst( m_entryStrings ) ) { auto* entry = new MenuItem( entryString, this ); m_entries.append( entry ); @@ -97,3 +92,13 @@ MenuBar::MenuBar( QQuickItem* parent ) : QskLinearBox( Qt::Vertical, parent ) new MenuItem( "Logout", this ); } + +QskAspect::Subcontrol MenuBar::effectiveSubcontrol( QskAspect::Subcontrol subControl ) const +{ + if( subControl == QskBox::Panel ) + { + return MenuBar::Panel; + } + + return subControl; +} diff --git a/examples/iot-dashboard/MenuBar.h b/examples/iot-dashboard/MenuBar.h index 15dba50d..3d23d1f0 100644 --- a/examples/iot-dashboard/MenuBar.h +++ b/examples/iot-dashboard/MenuBar.h @@ -26,8 +26,13 @@ class MenuBar : public QskLinearBox Q_OBJECT public: + QSK_SUBCONTROLS( Panel ) + MenuBar( QQuickItem* parent ); + QskAspect::Subcontrol effectiveSubcontrol( + QskAspect::Subcontrol subControl ) const override final; + private: QList< QString > m_entryStrings; QList< MenuItem* > m_entries;