qskinny/examples/iot-dashboard/BoxWithButtons.cpp

40 lines
1.0 KiB
C++
Raw Normal View History

2021-03-31 14:46:15 +00:00
#include "BoxWithButtons.h"
#include "RoundedIcon.h"
#include "Skin.h"
#include "UpAndDownButton.h"
#include <QskTextLabel.h>
2021-04-07 13:04:52 +00:00
QSK_SUBCONTROL( ButtonValueLabel, Text )
2021-04-07 14:03:36 +00:00
QSK_SUBCONTROL( TitleAndValueBox, Panel )
2021-03-31 14:46:15 +00:00
QSK_SUBCONTROL( BoxWithButtons, Panel )
2021-03-31 16:02:34 +00:00
QSK_SUBCONTROL( IndoorTemperature, Panel )
QSK_SUBCONTROL( Humidity, Panel )
2021-04-07 12:45:01 +00:00
BoxWithButtons::BoxWithButtons( const QString& title, const QString& value, bool isBright, QQuickItem* parent )
2021-03-31 14:46:15 +00:00
: Box( "", parent )
{
setPanel( true );
setSizePolicy( Qt::Vertical, QskSizePolicy::Maximum );
auto* layout = new QskLinearBox( Qt::Horizontal, this );
layout->setSpacing( 20 );
QString iconFile = title.toLower();
iconFile = iconFile.replace( ' ', '-' );
2021-04-07 07:44:21 +00:00
new RoundedIcon( iconFile, isBright, false, layout );
2021-03-31 14:46:15 +00:00
2021-04-07 14:03:36 +00:00
auto* titleAndValue = new TitleAndValueBox( Qt::Vertical, layout );
2021-03-31 14:46:15 +00:00
auto* titleLabel = new QskTextLabel( title, titleAndValue );
titleLabel->setFontRole( Skin::TitleFont );
2021-04-07 13:04:52 +00:00
new ButtonValueLabel( value, titleAndValue );
2021-03-31 14:46:15 +00:00
new UpAndDownButton( layout );
}