code reorganized
This commit is contained in:
parent
5bc2f504cf
commit
d7a7dc5c47
@ -4,22 +4,28 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "UsageBox.h"
|
#include "UsageBox.h"
|
||||||
#include "Skin.h"
|
|
||||||
|
|
||||||
|
#include <QskSkin.h>
|
||||||
#include <QskTextLabel.h>
|
#include <QskTextLabel.h>
|
||||||
|
|
||||||
QSK_SUBCONTROL( UsageBox, Separator )
|
QSK_SUBCONTROL( UsageBox, Separator )
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
class SeparatorLabel : public QskTextLabel
|
class UsageLine : public QskLinearBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
UsageLine( const QString& info, const QString& value, QQuickItem* parent )
|
||||||
SeparatorLabel( QQuickItem* parent = nullptr )
|
: QskLinearBox( Qt::Horizontal, parent )
|
||||||
: QskTextLabel( "_____", parent )
|
|
||||||
{
|
{
|
||||||
setSubcontrolProxy( QskTextLabel::Text, UsageBox::Separator );
|
auto infoLabel = new QskTextLabel( info, this );
|
||||||
|
infoLabel->setFontRole( QskSkin::SmallFont );
|
||||||
|
|
||||||
|
auto separator = new QskTextLabel( "_____", this );
|
||||||
|
separator->setSubcontrolProxy( QskTextLabel::Text, UsageBox::Separator );
|
||||||
|
|
||||||
|
auto valueLabel = new QskTextLabel( value, this );
|
||||||
|
valueLabel->setFontRole( QskSkin::SmallFont );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -27,30 +33,7 @@ namespace
|
|||||||
UsageBox::UsageBox( QQuickItem* parent )
|
UsageBox::UsageBox( QQuickItem* parent )
|
||||||
: Box( "Usage", parent )
|
: Box( "Usage", parent )
|
||||||
{
|
{
|
||||||
auto today = new QskLinearBox( Qt::Horizontal, this );
|
( void ) new UsageLine( "Usage today", "0,5 kwH", this );
|
||||||
auto todayText = new QskTextLabel( "Usage today", today );
|
( void ) new UsageLine( "Usage this month", "66 kwH", this );
|
||||||
todayText->setFontRole( QskSkin::SmallFont );
|
( void ) new UsageLine( "Total working hours", "125 hrs", this );
|
||||||
|
|
||||||
new SeparatorLabel( today );
|
|
||||||
|
|
||||||
auto todayValue = new QskTextLabel( "0,5 kwH", today );
|
|
||||||
todayValue->setFontRole( QskSkin::SmallFont );
|
|
||||||
|
|
||||||
auto month = new QskLinearBox( Qt::Horizontal, this );
|
|
||||||
auto monthText = new QskTextLabel( "Usage this month", month );
|
|
||||||
monthText->setFontRole( QskSkin::SmallFont );
|
|
||||||
|
|
||||||
new SeparatorLabel( month );
|
|
||||||
|
|
||||||
auto monthValue = new QskTextLabel( "66 kwH", month );
|
|
||||||
monthValue->setFontRole( QskSkin::SmallFont );
|
|
||||||
|
|
||||||
auto total = new QskLinearBox( Qt::Horizontal, this );
|
|
||||||
auto totalText = new QskTextLabel( "Total working hours", total );
|
|
||||||
totalText->setFontRole( QskSkin::SmallFont );
|
|
||||||
|
|
||||||
new SeparatorLabel( total );
|
|
||||||
|
|
||||||
auto totalValue = new QskTextLabel( "125 hrs", total );
|
|
||||||
totalValue->setFontRole( QskSkin::SmallFont );
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user