diff --git a/examples/iot-dashboard/Humidity.cpp b/examples/iot-dashboard/Humidity.cpp index 47537796..2970939f 100644 --- a/examples/iot-dashboard/Humidity.cpp +++ b/examples/iot-dashboard/Humidity.cpp @@ -29,6 +29,7 @@ Humidity::Humidity(QQuickItem *parent) value->setTextColor("#929CB2"); auto* buttons = new QskLinearBox(Qt::Vertical, this); + buttons->setSizePolicy(Qt::Horizontal, QskSizePolicy::Fixed); buttons->setSpacing(0); QImage upImage( ":/images/up.png"); diff --git a/examples/iot-dashboard/IndoorTemperature.cpp b/examples/iot-dashboard/IndoorTemperature.cpp index 4b99b0cb..66dd2a86 100644 --- a/examples/iot-dashboard/IndoorTemperature.cpp +++ b/examples/iot-dashboard/IndoorTemperature.cpp @@ -29,6 +29,7 @@ IndoorTemperature::IndoorTemperature(QQuickItem *parent) value->setTextColor("#929CB2"); auto* buttons = new QskLinearBox(Qt::Vertical, this); + buttons->setSizePolicy(Qt::Horizontal, QskSizePolicy::Fixed); buttons->setSpacing(0); QImage upImage( ":/images/up.png"); diff --git a/examples/iot-dashboard/MainContent.cpp b/examples/iot-dashboard/MainContent.cpp index f1d0fcf5..8401ff6b 100644 --- a/examples/iot-dashboard/MainContent.cpp +++ b/examples/iot-dashboard/MainContent.cpp @@ -3,6 +3,7 @@ #include "Card.h" #include "Humidity.h" #include "IndoorTemperature.h" +#include "MyDevices.h" #include "PieChart.h" #include "TopBar.h" #include "Usage.h" @@ -38,6 +39,9 @@ MainContent::MainContent( QQuickItem *parent ) : QskLinearBox( Qt::Vertical, par auto* humidity = new Humidity(gridBox); gridBox->addItem(humidity, 1, 1); + + auto* myDevices = new MyDevices(gridBox); + gridBox->addItem(myDevices, 0, 2, 2, 1); } void MainContent::addCard( const QString &title, QskControl *content, int column ) diff --git a/examples/iot-dashboard/MyDevices.cpp b/examples/iot-dashboard/MyDevices.cpp new file mode 100644 index 00000000..5cc78960 --- /dev/null +++ b/examples/iot-dashboard/MyDevices.cpp @@ -0,0 +1,52 @@ +#include "MyDevices.h" +#include "DaytimeSkin.h" +#include "RoundedIcon.h" + +#include +#include + +namespace { + class Device : public QskLinearBox + { + public: + Device(const QString& name, const QskGradient& gradient, QQuickItem* parent) + : QskLinearBox(Qt::Vertical, parent) + , m_name(name) + { + auto fileName = name.toLower(); + fileName.replace(' ', '-'); + auto* icon = new RoundedIcon(fileName, gradient, this); + icon->setOpacity(0.15); + auto* textLabel = new QskTextLabel(name, this); + textLabel->setAlignment(Qt::AlignHCenter); + } + + private: + QString m_name; + }; +} + +MyDevices::MyDevices(QQuickItem *parent) : QskLinearBox(Qt::Vertical, 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"); + QskGradient gradient2(QskGradient::Vertical, "#6100FF", "#6776FF"); + + auto* lamps = new Device("Lamps", gradient1, content); + content->addItem(lamps, 0, 0); + + auto* musicSystem = new Device("Music System", gradient2, content); + content->addItem(musicSystem, 0, 1); + + auto* ac = new Device("AC", gradient1, content); + content->addItem(ac, 1, 0); + + auto* router = new Device("Router", gradient2, content); + content->addItem(router, 1, 1); +} diff --git a/examples/iot-dashboard/MyDevices.h b/examples/iot-dashboard/MyDevices.h new file mode 100644 index 00000000..75953d2a --- /dev/null +++ b/examples/iot-dashboard/MyDevices.h @@ -0,0 +1,12 @@ +#ifndef MYDEVICES_H +#define MYDEVICES_H + +#include + +class MyDevices : public QskLinearBox +{ +public: + MyDevices( QQuickItem* parent); +}; + +#endif // MYDEVICES_H diff --git a/examples/iot-dashboard/images.qrc b/examples/iot-dashboard/images.qrc index 423b6367..f98310f0 100644 --- a/examples/iot-dashboard/images.qrc +++ b/examples/iot-dashboard/images.qrc @@ -12,5 +12,9 @@ images/humidity.png images/up.png images/down.png + images/lamps.png + images/music-system.png + images/ac.png + images/router.png diff --git a/examples/iot-dashboard/images/ac.png b/examples/iot-dashboard/images/ac.png new file mode 100644 index 00000000..51a75aa9 Binary files /dev/null and b/examples/iot-dashboard/images/ac.png differ diff --git a/examples/iot-dashboard/images/ac.svg b/examples/iot-dashboard/images/ac.svg new file mode 100644 index 00000000..20921e23 --- /dev/null +++ b/examples/iot-dashboard/images/ac.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/examples/iot-dashboard/images/lamps.png b/examples/iot-dashboard/images/lamps.png new file mode 100644 index 00000000..91536c1b Binary files /dev/null and b/examples/iot-dashboard/images/lamps.png differ diff --git a/examples/iot-dashboard/images/lamps.svg b/examples/iot-dashboard/images/lamps.svg new file mode 100644 index 00000000..76928255 --- /dev/null +++ b/examples/iot-dashboard/images/lamps.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/examples/iot-dashboard/images/music-system.png b/examples/iot-dashboard/images/music-system.png new file mode 100644 index 00000000..2df28477 Binary files /dev/null and b/examples/iot-dashboard/images/music-system.png differ diff --git a/examples/iot-dashboard/images/music-system.svg b/examples/iot-dashboard/images/music-system.svg new file mode 100644 index 00000000..5faf3b41 --- /dev/null +++ b/examples/iot-dashboard/images/music-system.svg @@ -0,0 +1,3 @@ + + + diff --git a/examples/iot-dashboard/images/router.png b/examples/iot-dashboard/images/router.png new file mode 100644 index 00000000..86bd1ca8 Binary files /dev/null and b/examples/iot-dashboard/images/router.png differ diff --git a/examples/iot-dashboard/images/router.svg b/examples/iot-dashboard/images/router.svg new file mode 100644 index 00000000..166cd71a --- /dev/null +++ b/examples/iot-dashboard/images/router.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/examples/iot-dashboard/iot-dashboard.pro b/examples/iot-dashboard/iot-dashboard.pro index dec833b7..9604b028 100644 --- a/examples/iot-dashboard/iot-dashboard.pro +++ b/examples/iot-dashboard/iot-dashboard.pro @@ -8,6 +8,7 @@ SOURCES += \ IndoorTemperature.cpp \ MainContent.cpp \ MenuBar.cpp \ + MyDevices.cpp \ PieChart.cpp \ PieChartPainted.cpp \ PieChartSkinlet.cpp \ @@ -26,6 +27,7 @@ HEADERS += \ MainContent.h \ MainWindow.h \ MenuBar.h \ + MyDevices.h \ PieChart.h \ PieChartPainted.h \ PieChartSkinlet.h \