style button boxes some more

This commit is contained in:
Peter Hartmann 2021-04-07 16:03:36 +02:00
parent 02e50ce298
commit 2db80364b1
3 changed files with 30 additions and 2 deletions

View File

@ -8,6 +8,8 @@
QSK_SUBCONTROL( ButtonValueLabel, Text )
QSK_SUBCONTROL( TitleAndValueBox, Panel )
QSK_SUBCONTROL( BoxWithButtons, Panel )
QSK_SUBCONTROL( IndoorTemperature, Panel )
@ -26,8 +28,7 @@ BoxWithButtons::BoxWithButtons( const QString& title, const QString& value, bool
iconFile = iconFile.replace( ' ', '-' );
new RoundedIcon( iconFile, isBright, false, layout );
auto* titleAndValue = new QskLinearBox( Qt::Vertical, layout );
titleAndValue->setMargins( {0, 10, 0, 0} );
auto* titleAndValue = new TitleAndValueBox( Qt::Vertical, layout );
auto* titleLabel = new QskTextLabel( title, titleAndValue );
titleLabel->setFontRole( Skin::TitleFont );

View File

@ -30,6 +30,31 @@ class ButtonValueLabel : public QskTextLabel
}
};
class TitleAndValueBox : public QskLinearBox
{
Q_OBJECT
public:
QSK_SUBCONTROLS( Panel )
TitleAndValueBox( Qt::Orientation orientation, QQuickItem* parent )
: QskLinearBox( orientation, parent )
{
setPanel( true );
}
QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override final
{
if( subControl == QskLinearBox::Panel )
{
return Panel;
}
return subControl;
}
};
class BoxWithButtons : public Box
{
public:

View File

@ -112,6 +112,8 @@ void Skin::initHints( const Palette& palette )
ed.setFontRole( ButtonValueLabel::Text, QskSkin::HugeFont );
ed.setColor( ButtonValueLabel::Text, "#929cb2" );
ed.setPadding( TitleAndValueBox::Panel, {0, 10, 0, 0} );
ed.setStrutSize( RoundButton::Panel, {27, 38} );
ed.setBoxShape( RoundButton::Panel, {0, 0, 30, 30} );
ed.setBoxShape( RoundButton::Panel | RoundButton::Top, {30, 30, 0, 0} );