From 1839a4c58b6f9b33f5f62dddaa33138ac69c9231 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Thu, 17 Sep 2020 16:47:34 +0200 Subject: [PATCH] put the rest in a box --- examples/iot-dashboard/Diagram.cpp | 6 ++++-- examples/iot-dashboard/Diagram.h | 4 ++-- examples/iot-dashboard/LightIntensity.cpp | 7 +------ examples/iot-dashboard/LightIntensity.h | 4 ++-- examples/iot-dashboard/MyDevices.cpp | 8 ++------ examples/iot-dashboard/MyDevices.h | 8 ++++---- 6 files changed, 15 insertions(+), 22 deletions(-) diff --git a/examples/iot-dashboard/Diagram.cpp b/examples/iot-dashboard/Diagram.cpp index 4ebe93ba..b835acb2 100644 --- a/examples/iot-dashboard/Diagram.cpp +++ b/examples/iot-dashboard/Diagram.cpp @@ -109,10 +109,12 @@ namespace static constexpr int segments = 7; Diagram::Diagram( QQuickItem* parent ) - : QskLinearBox( Qt::Vertical, parent ) + : Box( "", parent ) , m_weekdays( new QskGridBox( this ) ) , m_content( new DiagramContent( this ) ) { + setMarginsHint( Panel | QskAspect::Padding, 0 ); + setAutoAddChildren( false ); setAutoLayoutChildren( true ); @@ -138,7 +140,7 @@ Diagram::Diagram( QQuickItem* parent ) m_caption = new QskLinearBox( Qt::Horizontal, this ); addItem( m_caption, Qt::AlignRight ); m_caption->setSizePolicy( QskSizePolicy::Maximum, QskSizePolicy::Maximum ); - m_caption->setMargins( {10, 0, 10, 0} ); + m_caption->setMargins( {10, 10, 20, 0} ); m_caption->setSpacing( 30 ); m_caption->addItem( new CaptionItem( "#6776ff", "Water", this ) ); m_caption->addItem( new CaptionItem( "#ff3122", "Electricity", this ) ); diff --git a/examples/iot-dashboard/Diagram.h b/examples/iot-dashboard/Diagram.h index fb1e157a..4af9e0ce 100644 --- a/examples/iot-dashboard/Diagram.h +++ b/examples/iot-dashboard/Diagram.h @@ -1,14 +1,14 @@ #ifndef DIAGRAM_H #define DIAGRAM_H -#include +#include "Box.h" #include class DiagramContent; class QskGridBox; -class Diagram : public QskLinearBox +class Diagram : public Box { Q_OBJECT diff --git a/examples/iot-dashboard/LightIntensity.cpp b/examples/iot-dashboard/LightIntensity.cpp index 3d9c27cd..04b2bb49 100644 --- a/examples/iot-dashboard/LightIntensity.cpp +++ b/examples/iot-dashboard/LightIntensity.cpp @@ -97,12 +97,7 @@ void LightDisplay::updateLayout() } LightIntensity::LightIntensity( QQuickItem* parent ) - : QskLinearBox( Qt::Vertical, parent ) + : Box( "Light intensity", parent ) { - setMargins( 17 ); - - auto* title = new QskTextLabel( "Light Intensity", this ); - title->setFontRole( DaytimeSkin::TitleFont ); - new LightDisplay( this ); } diff --git a/examples/iot-dashboard/LightIntensity.h b/examples/iot-dashboard/LightIntensity.h index a85f423e..0b69f158 100644 --- a/examples/iot-dashboard/LightIntensity.h +++ b/examples/iot-dashboard/LightIntensity.h @@ -1,7 +1,7 @@ #ifndef LIGHTINTENSITY_H #define LIGHTINTENSITY_H -#include +#include "Box.h" #include @@ -47,7 +47,7 @@ class LightDisplay : public QskControl LightDimmer* m_dimmer; }; -class LightIntensity : public QskLinearBox +class LightIntensity : public Box { Q_OBJECT diff --git a/examples/iot-dashboard/MyDevices.cpp b/examples/iot-dashboard/MyDevices.cpp index 518122f5..a0b62144 100644 --- a/examples/iot-dashboard/MyDevices.cpp +++ b/examples/iot-dashboard/MyDevices.cpp @@ -56,13 +56,9 @@ namespace }; } -MyDevices::MyDevices( QQuickItem* parent ) : QskLinearBox( Qt::Vertical, parent ) +MyDevices::MyDevices( QQuickItem* parent ) + : Box( "My devices", parent ) { - setMargins( 17 ); - - auto* title = new QskTextLabel( "My Devices", this ); - title->setFontRole( DaytimeSkin::TitleFont ); - auto* content = new QskGridBox( this ); QskGradient gradient1( QskGradient::Vertical, "#FF3122", "#FF7D34" ); diff --git a/examples/iot-dashboard/MyDevices.h b/examples/iot-dashboard/MyDevices.h index 75953d2a..f214ee68 100644 --- a/examples/iot-dashboard/MyDevices.h +++ b/examples/iot-dashboard/MyDevices.h @@ -1,12 +1,12 @@ #ifndef MYDEVICES_H #define MYDEVICES_H -#include +#include "Box.h" -class MyDevices : public QskLinearBox +class MyDevices : public Box { -public: - MyDevices( QQuickItem* parent); + public: + MyDevices( QQuickItem* parent ); }; #endif // MYDEVICES_H