style button value label

This commit is contained in:
Peter Hartmann 2021-04-07 15:04:52 +02:00
parent 1e2d02a74f
commit cd3a6024b8
3 changed files with 29 additions and 3 deletions

View File

@ -6,6 +6,8 @@
#include <QskTextLabel.h> #include <QskTextLabel.h>
QSK_SUBCONTROL( ButtonValueLabel, Text )
QSK_SUBCONTROL( BoxWithButtons, Panel ) QSK_SUBCONTROL( BoxWithButtons, Panel )
QSK_SUBCONTROL( IndoorTemperature, Panel ) QSK_SUBCONTROL( IndoorTemperature, Panel )
@ -30,9 +32,7 @@ BoxWithButtons::BoxWithButtons( const QString& title, const QString& value, bool
auto* titleLabel = new QskTextLabel( title, titleAndValue ); auto* titleLabel = new QskTextLabel( title, titleAndValue );
titleLabel->setFontRole( Skin::TitleFont ); titleLabel->setFontRole( Skin::TitleFont );
auto* valueLabel = new QskTextLabel( value, titleAndValue ); new ButtonValueLabel( value, titleAndValue );
valueLabel->setFontRole( QskSkin::HugeFont );
valueLabel->setTextColor( "#929CB2" );
new UpAndDownButton( layout ); new UpAndDownButton( layout );
} }

View File

@ -5,6 +5,30 @@
#include "RoundedIcon.h" #include "RoundedIcon.h"
#include <QskBoxShapeMetrics.h> #include <QskBoxShapeMetrics.h>
#include <QskTextLabel.h>
class ButtonValueLabel : public QskTextLabel
{
Q_OBJECT
public:
QSK_SUBCONTROLS( Text )
ButtonValueLabel( const QString& text, QQuickItem* parent ) : QskTextLabel( text, parent )
{
}
QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override final
{
if( subControl == QskTextLabel::Text )
{
return Text;
}
return subControl;
}
};
class BoxWithButtons : public Box class BoxWithButtons : public Box
{ {

View File

@ -100,6 +100,8 @@ void Skin::initHints( const Palette& palette )
ed.setColor( TimeLabel::Text, "#6776FF" ); ed.setColor( TimeLabel::Text, "#6776FF" );
// content in boxes (indoor temperature, humidity etc.): // content in boxes (indoor temperature, humidity etc.):
ed.setFontRole( ButtonValueLabel::Text, QskSkin::HugeFont );
ed.setColor( ButtonValueLabel::Text, "#929cb2" );
ed.setPadding( BoxWithButtons::Panel, 8 ); ed.setPadding( BoxWithButtons::Panel, 8 );
ed.setBoxShape( RoundedIcon::Panel, 6 ); ed.setBoxShape( RoundedIcon::Panel, 6 );