Browse Source

thermostat: zoneItem in progress

master
rico rico 5 years ago
parent
commit
8460ff6760
3 changed files with 22 additions and 12 deletions
  1. +7
    -1
      soft/thermostat/inc/zoneitem.h
  2. +4
    -4
      soft/thermostat/src/mainwindow.cpp
  3. +11
    -7
      soft/thermostat/src/zoneitem.cpp

+ 7
- 1
soft/thermostat/inc/zoneitem.h View File

@ -11,14 +11,20 @@
#include <QWidget>
#include <QObject>
#include <QLabel>
#include <QPushButton>
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


+ 4
- 4
soft/thermostat/src/mainwindow.cpp View File

@ -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;


+ 11
- 7
soft/thermostat/src/zoneitem.cpp View File

@ -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);
}


Loading…
Cancel
Save