IOT dashboard: Use skinny shadows for light display
This commit is contained in:
parent
22db20e9eb
commit
3e91e83187
|
@ -43,10 +43,6 @@ LightDisplay::LightDisplay( QQuickItem* parent )
|
||||||
setAlignmentHint( ValueText, Qt::AlignRight );
|
setAlignmentHint( ValueText, Qt::AlignRight );
|
||||||
|
|
||||||
setBoundaries( 0, 100 );
|
setBoundaries( 0, 100 );
|
||||||
|
|
||||||
// ### move to Skin:
|
|
||||||
setShadow( { 0, 20 } );
|
|
||||||
setShadowColor( 0xe5e5e5 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LightDisplay::isPressed() const
|
bool LightDisplay::isPressed() const
|
||||||
|
@ -54,17 +50,6 @@ bool LightDisplay::isPressed() const
|
||||||
return hasSkinState( Pressed );
|
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 )
|
void LightDisplay::setGradient( const QskGradient& gradient )
|
||||||
{
|
{
|
||||||
m_gradient = gradient;
|
m_gradient = gradient;
|
||||||
|
@ -76,17 +61,6 @@ const QskGradient& LightDisplay::gradient() const
|
||||||
return m_gradient;
|
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 )
|
void LightDisplay::mousePressEvent( QMouseEvent* event )
|
||||||
{
|
{
|
||||||
QRectF handleRect = subControlRect( LightDisplay::Knob );
|
QRectF handleRect = subControlRect( LightDisplay::Knob );
|
||||||
|
|
|
@ -22,15 +22,9 @@ class LightDisplay : public QskBoundedValueInput
|
||||||
|
|
||||||
bool isPressed() const;
|
bool isPressed() const;
|
||||||
|
|
||||||
void setShadow( const QskShadowMetrics& );
|
|
||||||
const QskShadowMetrics& shadow() const;
|
|
||||||
|
|
||||||
void setGradient( const QskGradient& );
|
void setGradient( const QskGradient& );
|
||||||
const QskGradient& gradient() const;
|
const QskGradient& gradient() const;
|
||||||
|
|
||||||
void setShadowColor( const QColor& );
|
|
||||||
QColor shadowColor() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent( QMouseEvent* e ) override;
|
void mousePressEvent( QMouseEvent* e ) override;
|
||||||
void mouseMoveEvent( QMouseEvent* e ) override;
|
void mouseMoveEvent( QMouseEvent* e ) override;
|
||||||
|
|
|
@ -137,18 +137,7 @@ QSGNode* LightDisplaySkinlet::updateSubNode(
|
||||||
}
|
}
|
||||||
case GrooveRole:
|
case GrooveRole:
|
||||||
{
|
{
|
||||||
const QRectF grooveRect = display->subControlRect( LightDisplay::Groove );
|
return updateBoxNode( skinnable, node, 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;
|
|
||||||
}
|
}
|
||||||
case ColdAndWarmArcRole:
|
case ColdAndWarmArcRole:
|
||||||
{
|
{
|
||||||
|
|
|
@ -260,6 +260,11 @@ void Skin::initHints( const Palette& palette )
|
||||||
|
|
||||||
ed.setGradient( LightDisplay::Panel, palette.box );
|
ed.setGradient( LightDisplay::Panel, palette.box );
|
||||||
ed.setGradient( LightDisplay::Knob, 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, palette.roundButton );
|
||||||
ed.setGradient( RoundButton::Panel | QskAbstractButton::Pressed, palette.roundButtonPressed,
|
ed.setGradient( RoundButton::Panel | QskAbstractButton::Pressed, palette.roundButtonPressed,
|
||||||
{ QskStateCombination::CombinationNoState, RoundButton::Top } );
|
{ QskStateCombination::CombinationNoState, RoundButton::Top } );
|
||||||
|
@ -297,7 +302,7 @@ Skin::Palette NighttimeSkin::palette() const
|
||||||
0xff1a1a1a,
|
0xff1a1a1a,
|
||||||
0xff0c0c0c,
|
0xff0c0c0c,
|
||||||
Qt::white,
|
Qt::white,
|
||||||
0xff1a1a1a,
|
0xff4a4a4a,
|
||||||
{ { { 0.0, 0xff666666 }, { 0.5, 0xff222222 }, { 1.0, 0xff333333 } } },
|
{ { { 0.0, 0xff666666 }, { 0.5, 0xff222222 }, { 1.0, 0xff333333 } } },
|
||||||
0xff222222,
|
0xff222222,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue