add box around each section
This commit is contained in:
parent
b4b1fa701c
commit
5199e1af1e
|
@ -1,12 +1,26 @@
|
|||
#include "Card.h"
|
||||
#include "DaytimeSkin.h"
|
||||
|
||||
#include <QskBoxBorderColors.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskBoxShapeMetrics.h>
|
||||
#include <QskTextLabel.h>
|
||||
|
||||
Card::Card(const QString &title, QskControl *content, QQuickItem *parent ) : QskLinearBox( Qt::Vertical, parent ),
|
||||
m_title( title )
|
||||
Card::Card( const QString& title, QQuickItem* parent )
|
||||
: QskLinearBox( Qt::Vertical, parent )
|
||||
, m_title( title )
|
||||
, m_label( new QskTextLabel( m_title, this ) )
|
||||
{
|
||||
m_label = new QskTextLabel( m_title, this );
|
||||
m_content = content;
|
||||
m_content->setParentItem( this ); // ### maybe do it differently
|
||||
m_content->setParent( this );
|
||||
setAutoAddChildren( true );
|
||||
setAutoLayoutChildren( true );
|
||||
|
||||
setMarginsHint( Panel | QskAspect::Padding, 15 );
|
||||
setPanel( true );
|
||||
setBoxShapeHint( QskBox::Panel, 6 );
|
||||
setBoxBorderMetricsHint( QskBox::Panel, 2 );
|
||||
QskBoxBorderColors borderColors( "#dddddd" );
|
||||
borderColors.setAlpha( 100 );
|
||||
setBoxBorderColorsHint( QskBox::Panel, borderColors );
|
||||
|
||||
m_label->setFontRole( DaytimeSkin::TitleFont );
|
||||
}
|
||||
|
|
|
@ -7,13 +7,13 @@ class QskTextLabel;
|
|||
|
||||
class Card : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
Card( const QString& title, QskControl* content, QQuickItem* parent );
|
||||
public:
|
||||
Card( const QString& title, QQuickItem* parent );
|
||||
|
||||
private:
|
||||
QString m_title;
|
||||
QskTextLabel* m_label;
|
||||
QskControl* m_content;
|
||||
private:
|
||||
QString m_title;
|
||||
QskTextLabel* m_label;
|
||||
QskControl* m_content;
|
||||
};
|
||||
|
||||
#endif // CARD_H
|
||||
|
|
|
@ -29,9 +29,9 @@ MainContent::MainContent( QQuickItem* parent ) : QskLinearBox( Qt::Vertical, par
|
|||
gridBox->setPanel( true );
|
||||
gridBox->setBoxShapeHint( QskBox::Panel, 6 );
|
||||
gridBox->setBoxBorderMetricsHint( QskBox::Panel, 2 );
|
||||
QskBoxBorderColors borderColors( "#dddddd" );
|
||||
borderColors.setAlpha( 100 );
|
||||
gridBox->setBoxBorderColorsHint( QskBox::Panel, borderColors );
|
||||
// QskBoxBorderColors borderColors( "#dddddd" );
|
||||
// borderColors.setAlpha( 100 );
|
||||
// gridBox->setBoxBorderColorsHint( QskBox::Panel, borderColors );
|
||||
|
||||
auto* usage = new Usage( gridBox );
|
||||
gridBox->addItem( usage, 0, 0, 2, 1 );
|
||||
|
@ -51,8 +51,3 @@ MainContent::MainContent( QQuickItem* parent ) : QskLinearBox( Qt::Vertical, par
|
|||
auto* lightIntensity = new LightIntensity( gridBox );
|
||||
gridBox->addItem( lightIntensity, 2, 2 );
|
||||
}
|
||||
|
||||
void MainContent::addCard( const QString& title, QskControl* content, int column )
|
||||
{
|
||||
new Card( title, content, m_columns.at( column ) );
|
||||
}
|
||||
|
|
|
@ -5,15 +5,13 @@
|
|||
|
||||
class MainContent : public QskLinearBox
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainContent( QQuickItem* parent );
|
||||
public:
|
||||
MainContent( QQuickItem* parent );
|
||||
|
||||
private:
|
||||
void addCard( const QString& title, QskControl* content, int column = -1 );
|
||||
|
||||
QList< QskLinearBox* > m_columns;
|
||||
private:
|
||||
QList< QskLinearBox* > m_columns;
|
||||
};
|
||||
|
||||
#endif // MAINCONTENT_H
|
||||
|
|
|
@ -3,37 +3,32 @@
|
|||
|
||||
#include <QskTextLabel.h>
|
||||
|
||||
Usage::Usage(QQuickItem *parent)
|
||||
: QskLinearBox(Qt::Vertical, parent)
|
||||
Usage::Usage( QQuickItem* parent )
|
||||
: Card( "Usage", parent )
|
||||
{
|
||||
setMargins(17);
|
||||
auto* content = new QskLinearBox( Qt::Vertical, this );
|
||||
|
||||
auto* title = new QskTextLabel("Usage", this);
|
||||
title->setFontRole(DaytimeSkin::TitleFont);
|
||||
auto* today = new QskLinearBox( Qt::Horizontal, content );
|
||||
auto* todayText = new QskTextLabel( "Usage today", today );
|
||||
todayText->setFontRole( QskSkin::SmallFont );
|
||||
auto* todaySpacer = new QskTextLabel( "_____", today );
|
||||
todaySpacer->setTextColor( "#dddddd" );
|
||||
auto* todayValue = new QskTextLabel( "0,5 kwH", today );
|
||||
todayValue->setFontRole( QskSkin::SmallFont );
|
||||
|
||||
auto* content = new QskLinearBox(Qt::Vertical, this);
|
||||
auto* month = new QskLinearBox( Qt::Horizontal, content );
|
||||
auto* monthText = new QskTextLabel( "Usage this month", month );
|
||||
monthText->setFontRole( QskSkin::SmallFont );
|
||||
auto* monthSpacer = new QskTextLabel( "_____", month );
|
||||
monthSpacer->setTextColor( "#dddddd" );
|
||||
auto* monthValue = new QskTextLabel( "66 kwH", month );
|
||||
monthValue->setFontRole( QskSkin::SmallFont );
|
||||
|
||||
auto* today = new QskLinearBox(Qt::Horizontal, content);
|
||||
auto* todayText = new QskTextLabel("Usage today", today);
|
||||
todayText->setFontRole(QskSkin::SmallFont);
|
||||
auto* todaySpacer = new QskTextLabel("_____", today);
|
||||
todaySpacer->setTextColor("#dddddd");
|
||||
auto* todayValue = new QskTextLabel("0,5 kwH", today);
|
||||
todayValue->setFontRole(QskSkin::SmallFont);
|
||||
|
||||
auto* month = new QskLinearBox(Qt::Horizontal, content);
|
||||
auto* monthText = new QskTextLabel("Usage this month", month);
|
||||
monthText->setFontRole(QskSkin::SmallFont);
|
||||
auto* monthSpacer = new QskTextLabel("_____", month);
|
||||
monthSpacer->setTextColor("#dddddd");
|
||||
auto* monthValue = new QskTextLabel("66 kwH", month);
|
||||
monthValue->setFontRole(QskSkin::SmallFont);
|
||||
|
||||
auto* total = new QskLinearBox(Qt::Horizontal, content);
|
||||
auto* totalText = new QskTextLabel("Total working hours", total);
|
||||
totalText->setFontRole(QskSkin::SmallFont);
|
||||
auto* totalSpacer = new QskTextLabel("_____", total);
|
||||
totalSpacer->setTextColor("#dddddd");
|
||||
auto* totalValue = new QskTextLabel("125 hrs", total);
|
||||
totalValue->setFontRole(QskSkin::SmallFont);
|
||||
auto* total = new QskLinearBox( Qt::Horizontal, content );
|
||||
auto* totalText = new QskTextLabel( "Total working hours", total );
|
||||
totalText->setFontRole( QskSkin::SmallFont );
|
||||
auto* totalSpacer = new QskTextLabel( "_____", total );
|
||||
totalSpacer->setTextColor( "#dddddd" );
|
||||
auto* totalValue = new QskTextLabel( "125 hrs", total );
|
||||
totalValue->setFontRole( QskSkin::SmallFont );
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
#ifndef USAGE_H
|
||||
#define USAGE_H
|
||||
|
||||
#include "Card.h"
|
||||
#include <QskLinearBox.h>
|
||||
|
||||
class Usage : public QskLinearBox
|
||||
class Usage : public Card
|
||||
{
|
||||
public:
|
||||
Usage( QQuickItem* parent);
|
||||
public:
|
||||
Usage( QQuickItem* parent );
|
||||
};
|
||||
|
||||
#endif // USAGE_H
|
||||
|
|
Loading…
Reference in New Issue