Browse Source

thermostat: introduce QStackedwidget

master
Richard Genoud 5 years ago
parent
commit
407c34b527
2 changed files with 5 additions and 1 deletions
  1. +2
    -0
      soft/thermostat/inc/mainwindow.h
  2. +3
    -1
      soft/thermostat/src/mainwindow.cpp

+ 2
- 0
soft/thermostat/inc/mainwindow.h View File

@ -9,6 +9,7 @@
#ifndef MAINWINDOW_H #ifndef MAINWINDOW_H
#define MAINWINDOW_H #define MAINWINDOW_H
#include <QStackedWidget>
#include <QMainWindow> #include <QMainWindow>
#include <QPushButton> #include <QPushButton>
#include <QtWidgets> #include <QtWidgets>
@ -32,6 +33,7 @@ private:
QPushButton m_state_btn; QPushButton m_state_btn;
QVector<ZoneItem *> m_zones; QVector<ZoneItem *> m_zones;
QTimer *m_timer; QTimer *m_timer;
QStackedWidget m_central_widget;
void update_state_btn(enum power_states st); void update_state_btn(enum power_states st);
double get_target_temperature(int room_idx); double get_target_temperature(int room_idx);
bool get_heater_order(int room_idx); bool get_heater_order(int room_idx);


+ 3
- 1
soft/thermostat/src/mainwindow.cpp View File

@ -66,10 +66,12 @@ MainWindow::MainWindow(QWidget *parent) :
QWidget *mainWidget = new QWidget; QWidget *mainWidget = new QWidget;
mainWidget->setLayout(mainLayout); mainWidget->setLayout(mainLayout);
m_central_widget.addWidget(mainWidget);
/* /*
* Top widget * Top widget
*/ */
setCentralWidget(mainWidget);
setCentralWidget(&m_central_widget);
setWindowTitle(tr("Sorico's thermostat")); setWindowTitle(tr("Sorico's thermostat"));


Loading…
Cancel
Save