diff --git a/examples/iotdashboard/LightDisplay.cpp b/examples/iotdashboard/LightDisplay.cpp index 25a6f24f..42dd8713 100644 --- a/examples/iotdashboard/LightDisplay.cpp +++ b/examples/iotdashboard/LightDisplay.cpp @@ -43,10 +43,6 @@ LightDisplay::LightDisplay( QQuickItem* parent ) setAlignmentHint( ValueText, Qt::AlignRight ); setBoundaries( 0, 100 ); - - // ### move to Skin: - setShadow( { 0, 20 } ); - setShadowColor( 0xe5e5e5 ); } bool LightDisplay::isPressed() const @@ -54,17 +50,6 @@ bool LightDisplay::isPressed() const return hasSkinState( Pressed ); } -void LightDisplay::setShadow( const QskShadowMetrics& shadow ) -{ - m_shadow = shadow; - update(); -} - -const QskShadowMetrics& LightDisplay::shadow() const -{ - return m_shadow; -} - void LightDisplay::setGradient( const QskGradient& gradient ) { m_gradient = gradient; @@ -76,17 +61,6 @@ const QskGradient& LightDisplay::gradient() const return m_gradient; } -void LightDisplay::setShadowColor( const QColor& color ) -{ - m_shadowColor = color; - update(); -} - -QColor LightDisplay::shadowColor() const -{ - return m_shadowColor; -} - void LightDisplay::mousePressEvent( QMouseEvent* event ) { QRectF handleRect = subControlRect( LightDisplay::Knob ); diff --git a/examples/iotdashboard/LightDisplay.h b/examples/iotdashboard/LightDisplay.h index 9aa7f0b6..9049a5b3 100644 --- a/examples/iotdashboard/LightDisplay.h +++ b/examples/iotdashboard/LightDisplay.h @@ -22,15 +22,9 @@ class LightDisplay : public QskBoundedValueInput bool isPressed() const; - void setShadow( const QskShadowMetrics& ); - const QskShadowMetrics& shadow() const; - void setGradient( const QskGradient& ); const QskGradient& gradient() const; - void setShadowColor( const QColor& ); - QColor shadowColor() const; - protected: void mousePressEvent( QMouseEvent* e ) override; void mouseMoveEvent( QMouseEvent* e ) override; diff --git a/examples/iotdashboard/LightDisplaySkinlet.cpp b/examples/iotdashboard/LightDisplaySkinlet.cpp index 27760636..6c6308bc 100644 --- a/examples/iotdashboard/LightDisplaySkinlet.cpp +++ b/examples/iotdashboard/LightDisplaySkinlet.cpp @@ -137,18 +137,7 @@ QSGNode* LightDisplaySkinlet::updateSubNode( } case GrooveRole: { - const QRectF grooveRect = display->subControlRect( LightDisplay::Groove ); - if ( grooveRect.isEmpty() ) - return nullptr; - - const auto& shadowMetrics = display->shadow(); - const auto shadowRect = shadowMetrics.shadowRect( grooveRect ); - - auto shadowNode = QskSGNode::ensureNode< QskBoxShadowNode >( node ); - shadowNode->setShadowData( shadowRect, grooveRect.width() / 2, - shadowMetrics.blurRadius(), display->shadowColor() ); - - return shadowNode; + return updateBoxNode( skinnable, node, LightDisplay::Groove ); } case ColdAndWarmArcRole: { diff --git a/examples/iotdashboard/Skin.cpp b/examples/iotdashboard/Skin.cpp index a4212949..0b86a7c3 100644 --- a/examples/iotdashboard/Skin.cpp +++ b/examples/iotdashboard/Skin.cpp @@ -260,6 +260,11 @@ void Skin::initHints( const Palette& palette ) ed.setGradient( LightDisplay::Panel, palette.box ); ed.setGradient( LightDisplay::Knob, palette.box ); + ed.setShadowMetrics( LightDisplay::Groove, { 0, 20 } ); + ed.setShadowColor( LightDisplay::Groove, palette.shadow ); + ed.setGradient( LightDisplay::Groove, palette.box ); + ed.setBoxShape( LightDisplay::Groove, 100, Qt::RelativeSize ); + ed.setGradient( RoundButton::Panel, palette.roundButton ); ed.setGradient( RoundButton::Panel | QskAbstractButton::Pressed, palette.roundButtonPressed, { QskStateCombination::CombinationNoState, RoundButton::Top } ); @@ -297,7 +302,7 @@ Skin::Palette NighttimeSkin::palette() const 0xff1a1a1a, 0xff0c0c0c, Qt::white, - 0xff1a1a1a, + 0xff4a4a4a, { { { 0.0, 0xff666666 }, { 0.5, 0xff222222 }, { 1.0, 0xff333333 } } }, 0xff222222, };