add box around each section
This commit is contained in:
parent
b4b1fa701c
commit
5199e1af1e
|
@ -1,12 +1,26 @@
|
||||||
#include "Card.h"
|
#include "Card.h"
|
||||||
|
#include "DaytimeSkin.h"
|
||||||
|
|
||||||
|
#include <QskBoxBorderColors.h>
|
||||||
|
#include <QskBoxBorderMetrics.h>
|
||||||
|
#include <QskBoxShapeMetrics.h>
|
||||||
#include <QskTextLabel.h>
|
#include <QskTextLabel.h>
|
||||||
|
|
||||||
Card::Card(const QString &title, QskControl *content, QQuickItem *parent ) : QskLinearBox( Qt::Vertical, parent ),
|
Card::Card( const QString& title, QQuickItem* parent )
|
||||||
m_title( title )
|
: QskLinearBox( Qt::Vertical, parent )
|
||||||
|
, m_title( title )
|
||||||
|
, m_label( new QskTextLabel( m_title, this ) )
|
||||||
{
|
{
|
||||||
m_label = new QskTextLabel( m_title, this );
|
setAutoAddChildren( true );
|
||||||
m_content = content;
|
setAutoLayoutChildren( true );
|
||||||
m_content->setParentItem( this ); // ### maybe do it differently
|
|
||||||
m_content->setParent( this );
|
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 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ class QskTextLabel;
|
||||||
class Card : public QskLinearBox
|
class Card : public QskLinearBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Card( const QString& title, QskControl* content, QQuickItem* parent );
|
Card( const QString& title, QQuickItem* parent );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_title;
|
QString m_title;
|
||||||
|
|
|
@ -29,9 +29,9 @@ MainContent::MainContent( QQuickItem* parent ) : QskLinearBox( Qt::Vertical, par
|
||||||
gridBox->setPanel( true );
|
gridBox->setPanel( true );
|
||||||
gridBox->setBoxShapeHint( QskBox::Panel, 6 );
|
gridBox->setBoxShapeHint( QskBox::Panel, 6 );
|
||||||
gridBox->setBoxBorderMetricsHint( QskBox::Panel, 2 );
|
gridBox->setBoxBorderMetricsHint( QskBox::Panel, 2 );
|
||||||
QskBoxBorderColors borderColors( "#dddddd" );
|
// QskBoxBorderColors borderColors( "#dddddd" );
|
||||||
borderColors.setAlpha( 100 );
|
// borderColors.setAlpha( 100 );
|
||||||
gridBox->setBoxBorderColorsHint( QskBox::Panel, borderColors );
|
// gridBox->setBoxBorderColorsHint( QskBox::Panel, borderColors );
|
||||||
|
|
||||||
auto* usage = new Usage( gridBox );
|
auto* usage = new Usage( gridBox );
|
||||||
gridBox->addItem( usage, 0, 0, 2, 1 );
|
gridBox->addItem( usage, 0, 0, 2, 1 );
|
||||||
|
@ -51,8 +51,3 @@ MainContent::MainContent( QQuickItem* parent ) : QskLinearBox( Qt::Vertical, par
|
||||||
auto* lightIntensity = new LightIntensity( gridBox );
|
auto* lightIntensity = new LightIntensity( gridBox );
|
||||||
gridBox->addItem( lightIntensity, 2, 2 );
|
gridBox->addItem( lightIntensity, 2, 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainContent::addCard( const QString& title, QskControl* content, int column )
|
|
||||||
{
|
|
||||||
new Card( title, content, m_columns.at( column ) );
|
|
||||||
}
|
|
||||||
|
|
|
@ -11,8 +11,6 @@ public:
|
||||||
MainContent( QQuickItem* parent );
|
MainContent( QQuickItem* parent );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addCard( const QString& title, QskControl* content, int column = -1 );
|
|
||||||
|
|
||||||
QList< QskLinearBox* > m_columns;
|
QList< QskLinearBox* > m_columns;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,8 @@
|
||||||
#include <QskTextLabel.h>
|
#include <QskTextLabel.h>
|
||||||
|
|
||||||
Usage::Usage( QQuickItem* parent )
|
Usage::Usage( QQuickItem* parent )
|
||||||
: QskLinearBox(Qt::Vertical, parent)
|
: Card( "Usage", parent )
|
||||||
{
|
{
|
||||||
setMargins(17);
|
|
||||||
|
|
||||||
auto* title = new QskTextLabel("Usage", this);
|
|
||||||
title->setFontRole(DaytimeSkin::TitleFont);
|
|
||||||
|
|
||||||
auto* content = new QskLinearBox( Qt::Vertical, this );
|
auto* content = new QskLinearBox( Qt::Vertical, this );
|
||||||
|
|
||||||
auto* today = new QskLinearBox( Qt::Horizontal, content );
|
auto* today = new QskLinearBox( Qt::Horizontal, content );
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#ifndef USAGE_H
|
#ifndef USAGE_H
|
||||||
#define USAGE_H
|
#define USAGE_H
|
||||||
|
|
||||||
|
#include "Card.h"
|
||||||
#include <QskLinearBox.h>
|
#include <QskLinearBox.h>
|
||||||
|
|
||||||
class Usage : public QskLinearBox
|
class Usage : public Card
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Usage( QQuickItem* parent );
|
Usage( QQuickItem* parent );
|
||||||
|
|
Loading…
Reference in New Issue