diff --git a/examples/iotdashboard/DashboardPage.cpp b/examples/iotdashboard/DashboardPage.cpp index cc3ece19..18180ea3 100644 --- a/examples/iotdashboard/DashboardPage.cpp +++ b/examples/iotdashboard/DashboardPage.cpp @@ -9,6 +9,7 @@ #include "BoxWithButtons.h" #include "UsageDiagram.h" #include "LightDisplay.h" +#include "GridBox.h" #include "MyDevices.h" #include "PieChart.h" #include "TopBar.h" @@ -26,7 +27,6 @@ #include QSK_SUBCONTROL( DashboardPage, Panel ) -QSK_SUBCONTROL( MainContentGridBox, Panel ) namespace { diff --git a/examples/iotdashboard/DashboardPage.h b/examples/iotdashboard/DashboardPage.h index 9b11ff23..f70e5e8a 100644 --- a/examples/iotdashboard/DashboardPage.h +++ b/examples/iotdashboard/DashboardPage.h @@ -8,20 +8,6 @@ #include #include -class MainContentGridBox : public QskGridBox -{ - Q_OBJECT - - public: - QSK_SUBCONTROLS( Panel ) - - MainContentGridBox( QQuickItem* parent = nullptr ) - : QskGridBox( parent ) - { - setSubcontrolProxy( QskGridBox::Panel, Panel ); - } -}; - class DashboardPage : public QskLinearBox { Q_OBJECT diff --git a/examples/iotdashboard/GridBox.cpp b/examples/iotdashboard/GridBox.cpp new file mode 100644 index 00000000..b501e6b1 --- /dev/null +++ b/examples/iotdashboard/GridBox.cpp @@ -0,0 +1,10 @@ +/****************************************************************************** + * Copyright (C) 2021 Edelhirsch Software GmbH + * This file may be used under the terms of the 3-clause BSD License + *****************************************************************************/ + +#include "GridBox.h" + +QSK_SUBCONTROL( MainContentGridBox, Panel ) + +#include "moc_GridBox.cpp" diff --git a/examples/iotdashboard/GridBox.h b/examples/iotdashboard/GridBox.h new file mode 100644 index 00000000..7580107b --- /dev/null +++ b/examples/iotdashboard/GridBox.h @@ -0,0 +1,23 @@ +/****************************************************************************** + * Copyright (C) 2021 Edelhirsch Software GmbH + * This file may be used under the terms of the 3-clause BSD License + *****************************************************************************/ + +#pragma once + +#include +#include + +class MainContentGridBox : public QskGridBox +{ + Q_OBJECT + + public: + QSK_SUBCONTROLS( Panel ) + + MainContentGridBox( QQuickItem* parent = nullptr ) + : QskGridBox( parent ) + { + setSubcontrolProxy( QskGridBox::Panel, Panel ); + } +}; diff --git a/examples/iotdashboard/RoomsPage.cpp b/examples/iotdashboard/RoomsPage.cpp new file mode 100644 index 00000000..581faaad --- /dev/null +++ b/examples/iotdashboard/RoomsPage.cpp @@ -0,0 +1,91 @@ +/****************************************************************************** + * Copyright (C) 2021 Edelhirsch Software GmbH + * This file may be used under the terms of the 3-clause BSD License + *****************************************************************************/ + +#include "RoomsPage.h" + +#include "Box.h" +#include "BoxWithButtons.h" +#include "GridBox.h" +#include "LightDisplay.h" +#include "MyDevices.h" +#include "PieChart.h" +#include "TopBar.h" +#include "UsageBox.h" +#include "UsageDiagram.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +QSK_SUBCONTROL( RoomsPage, Panel ) + +namespace +{ + class IndoorTemperature : public BoxWithButtons + { + public: + IndoorTemperature( QQuickItem* parent = nullptr ) + : BoxWithButtons( "Indoor Temperature", "+24", true, parent ) + { + } + }; + + class Humidity : public BoxWithButtons + { + public: + Humidity( QQuickItem* parent = nullptr ) + : BoxWithButtons( "Humidity", "30%", false, parent ) + { + } + }; + + class LightIntensity : public Box + { + public: + LightIntensity( QQuickItem* parent = nullptr ) + : Box( "Light intensity", parent ) + { + addSpacer( 5 ); + auto* lightDisplay = new LightDisplay( this ); + lightDisplay->setValue( 50.0 ); + } + }; +} + +RoomsPage::RoomsPage( QQuickItem* parent ) + : QskLinearBox( Qt::Vertical, parent ) +{ + setPanel( true ); + setSubcontrolProxy( QskBox::Panel, RoomsPage::Panel ); + + setAutoAddChildren( false ); + setSizePolicy( QskSizePolicy::Expanding, QskSizePolicy::Expanding ); + setDefaultAlignment( Qt::AlignTop ); + setSpacing( 24 ); + + auto topBar = new TopBar(); + + auto gridBox = new MainContentGridBox(); + gridBox->setPanel( true ); + gridBox->setSpacing( 15 ); + + gridBox->addItem( new UsageBox(), 0, 0, 2, 1 ); + + gridBox->setColumnStretchFactor( 0, 37 ); // factors add up to 100 + gridBox->setColumnStretchFactor( 1, 37 ); + gridBox->setColumnStretchFactor( 2, 26 ); + + addItem( topBar ); + addItem( gridBox ); +} + +#include "moc_RoomsPage.cpp" diff --git a/examples/iotdashboard/RoomsPage.h b/examples/iotdashboard/RoomsPage.h new file mode 100644 index 00000000..0cafcff3 --- /dev/null +++ b/examples/iotdashboard/RoomsPage.h @@ -0,0 +1,22 @@ +/****************************************************************************** + * Copyright (C) 2021 Edelhirsch Software GmbH + * This file may be used under the terms of the 3-clause BSD License + *****************************************************************************/ + +#pragma once + +#include +#include + +class RoomsPage : public QskLinearBox +{ + Q_OBJECT + + public: + QSK_SUBCONTROLS( Panel ) + + RoomsPage( QQuickItem* parent ); + + private: + QList< QskLinearBox* > m_columns; +}; diff --git a/examples/iotdashboard/Skin.cpp b/examples/iotdashboard/Skin.cpp index b4ab3c96..26f53a5c 100644 --- a/examples/iotdashboard/Skin.cpp +++ b/examples/iotdashboard/Skin.cpp @@ -11,6 +11,7 @@ #include "CircularProgressBarSkinlet.h" #include "Diagram.h" #include "DiagramSkinlet.h" +#include "GridBox.h" #include "LightDisplay.h" #include "LightDisplaySkinlet.h" #include "DashboardPage.h" diff --git a/examples/iotdashboard/iotdashboard.pro b/examples/iotdashboard/iotdashboard.pro index 9f373565..82dd7a81 100644 --- a/examples/iotdashboard/iotdashboard.pro +++ b/examples/iotdashboard/iotdashboard.pro @@ -12,6 +12,7 @@ SOURCES += \ Diagram.cpp \ DiagramSkinlet.cpp \ GraphicProvider.cpp \ + GridBox.cpp \ LightDisplaySkinlet.cpp \ LightDisplay.cpp \ MainItem.cpp \ @@ -20,6 +21,7 @@ SOURCES += \ PieChart.cpp \ PieChartPainted.cpp \ PieChartSkinlet.cpp \ + RoomsPage.cpp \ RoundedIcon.cpp \ ShadowedBox.cpp \ Skin.cpp \ @@ -43,6 +45,7 @@ HEADERS += \ Diagram.h \ DiagramSkinlet.h \ GraphicProvider.h \ + GridBox.h \ LightDisplaySkinlet.h \ LightDisplay.h \ DashboardPage.h \ @@ -53,6 +56,7 @@ HEADERS += \ PieChart.h \ PieChartPainted.h \ PieChartSkinlet.h \ + RoomsPage.h \ RoundedIcon.h \ ShadowedBox.h \ Skin.h \