diff --git a/soft/thermostat/inc/zoneitem.h b/soft/thermostat/inc/zoneitem.h index 5afeb52..bc05a1c 100644 --- a/soft/thermostat/inc/zoneitem.h +++ b/soft/thermostat/inc/zoneitem.h @@ -11,14 +11,20 @@ #include #include +#include +#include class ZoneItem : public QWidget { Q_OBJECT public: - explicit ZoneItem(QWidget *parent = Q_NULLPTR); + explicit ZoneItem(const QString &zoneName, QWidget *parent = Q_NULLPTR); ~ZoneItem(); +private: + QPushButton m_zoneNameBtn; + QPushButton m_temperatureBtn; + QPushButton m_hygroBtn; }; #endif // ZONEITEM_H diff --git a/soft/thermostat/src/mainwindow.cpp b/soft/thermostat/src/mainwindow.cpp index 73384a6..7f161ed 100644 --- a/soft/thermostat/src/mainwindow.cpp +++ b/soft/thermostat/src/mainwindow.cpp @@ -23,11 +23,11 @@ MainWindow::MainWindow(QWidget *parent) : */ QGridLayout *mainLayout = new QGridLayout; - mainLayout->addWidget(new ZoneItem(this), 0, 0); - mainLayout->addWidget(new ZoneItem(this), 0, 1); + mainLayout->addWidget(new ZoneItem(tr("Living room"), this), 0, 0); + mainLayout->addWidget(new ZoneItem(tr("Workspace"), this), 0, 1); mainLayout->addWidget(new QPushButton(tr("Menu")), 0, 2); - mainLayout->addWidget(new ZoneItem(this), 1, 0); - mainLayout->addWidget(new ZoneItem(this), 1, 1); + mainLayout->addWidget(new ZoneItem(tr("Bathroom"), this), 1, 0); + mainLayout->addWidget(new ZoneItem(tr("Bedroom"), this), 1, 1); mainLayout->addWidget(new QPushButton(tr("Auto")), 1, 2); QWidget *mainWidget = new QWidget; diff --git a/soft/thermostat/src/zoneitem.cpp b/soft/thermostat/src/zoneitem.cpp index 0b19763..677a8cd 100644 --- a/soft/thermostat/src/zoneitem.cpp +++ b/soft/thermostat/src/zoneitem.cpp @@ -14,19 +14,23 @@ #include "zoneitem.h" -ZoneItem::ZoneItem(QWidget *parent) : +ZoneItem::ZoneItem(const QString &zoneName, QWidget *parent) : QWidget(parent) { + m_zoneNameBtn.setText(zoneName); + m_zoneNameBtn.setFlat(true); + m_temperatureBtn.setText("20.3°C / 20°C"); + m_temperatureBtn.setFlat(true); + m_hygroBtn.setText("45%h"); + m_hygroBtn.setFlat(true); + /* * Layout for the left part of the window */ QVBoxLayout *topLayout = new QVBoxLayout; - QPushButton *btn = new QPushButton; - btn->setText("20°C"); - btn->setFlat(true); - topLayout->addWidget(new QLabel(tr("Living room"))); - topLayout->addWidget(btn); - topLayout->addWidget(new QLabel("45%h")); + topLayout->addWidget(&m_zoneNameBtn); + topLayout->addWidget(&m_temperatureBtn); + topLayout->addWidget(&m_hygroBtn); this->setLayout(topLayout); }