style round button

This commit is contained in:
Peter Hartmann 2021-04-07 15:11:20 +02:00
parent cd3a6024b8
commit 02e50ce298
4 changed files with 23 additions and 19 deletions

View File

@ -100,8 +100,6 @@ void Skin::initHints( const Palette& palette )
ed.setColor( TimeLabel::Text, "#6776FF" );
// content in boxes (indoor temperature, humidity etc.):
ed.setFontRole( ButtonValueLabel::Text, QskSkin::HugeFont );
ed.setColor( ButtonValueLabel::Text, "#929cb2" );
ed.setPadding( BoxWithButtons::Panel, 8 );
ed.setBoxShape( RoundedIcon::Panel, 6 );
@ -111,6 +109,13 @@ void Skin::initHints( const Palette& palette )
ed.setMetric( RoundedIcon::Panel | RoundedIcon::Small | QskAspect::Size, 60 );
ed.setMetric( RoundedIcon::Icon | QskAspect::Size, 36 );
ed.setFontRole( ButtonValueLabel::Text, QskSkin::HugeFont );
ed.setColor( ButtonValueLabel::Text, "#929cb2" );
ed.setStrutSize( RoundButton::Panel, {27, 38} );
ed.setBoxShape( RoundButton::Panel, {0, 0, 30, 30} );
ed.setBoxShape( RoundButton::Panel | RoundButton::Top, {30, 30, 0, 0} );
// diagram:
ed.setBoxBorderMetrics( WeekdayBox::Panel, {0, 0, 3, 3} );

View File

@ -9,31 +9,29 @@
QSK_SUBCONTROL( RoundButton, Panel )
RoundButton::RoundButton( Qt::Edge edge, QQuickItem* parent )
QSK_STATE( RoundButton, Top, ( QskAspect::FirstUserState << 1 ) )
RoundButton::RoundButton( QskAspect::Placement placement, QQuickItem* parent )
: QskPushButton( parent )
{
setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Expanding );
setFixedWidth( 42 );
setFixedHeight( 46.31 );
QskGraphic graphic;
QImage image;
if( edge == Qt::TopEdge )
if( placement == QskAspect::Top )
{
setBoxShapeHint( RoundButton::Panel, {30, 30, 0, 0} );
QImage upImage( ":/images/up.png" );
graphic = QskGraphic::fromImage( upImage );
setSkinStateFlag( Top );
image.load( ":/images/up.svg" );
}
else
{
setBoxShapeHint( RoundButton::Panel, {0, 0, 30, 30} );
QImage downImage( ":/images/down.png" );
graphic = QskGraphic::fromImage( downImage );
image.load( ":/images/down.svg" );
}
graphic.setDefaultSize( {10, 5.71} );
setGraphicSourceSize( image.size() );
graphic = QskGraphic::fromImage( image );
setGraphic( graphic );
setGraphicSourceSize( {10, 5.71} );
}
QskAspect::Subcontrol RoundButton::effectiveSubcontrol( QskAspect::Subcontrol subControl ) const
@ -52,6 +50,6 @@ UpAndDownButton::UpAndDownButton( QQuickItem* parent )
setSizePolicy( Qt::Horizontal, QskSizePolicy::Fixed );
setSpacing( 0 );
/*auto* upButton =*/ new RoundButton( Qt::TopEdge, this );
/*auto* downButton =*/ new RoundButton( Qt::BottomEdge, this );
new RoundButton( QskAspect::Top, this );
new RoundButton( QskAspect::Bottom, this );
}

View File

@ -10,8 +10,9 @@ class RoundButton : QskPushButton
public:
QSK_SUBCONTROLS( Panel )
QSK_STATES( Top )
RoundButton( Qt::Edge edge, QQuickItem* parent );
RoundButton( QskAspect::Placement placement, QQuickItem* parent );
QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override final;

View File

@ -10,8 +10,8 @@
<file>images/logout.png</file>
<file>images/indoor-temperature.png</file>
<file>images/humidity.png</file>
<file>images/up.png</file>
<file>images/down.png</file>
<file>images/up.svg</file>
<file>images/down.svg</file>
<file>images/lamps.png</file>
<file>images/music-system.png</file>
<file>images/ac.png</file>