Browse Source

thermostat: edit prog dlg: add start&end time

master
Richard Genoud 4 years ago
parent
commit
4a162d1f60
1 changed files with 41 additions and 4 deletions
  1. +41
    -4
      soft/thermostat/src/edit_prog_dlg.cpp

+ 41
- 4
soft/thermostat/src/edit_prog_dlg.cpp View File

@ -7,17 +7,14 @@
*/
#include <QLoggingCategory>
#include <QDialogButtonBox>
#include <QDoubleSpinBox>
#include <QSpinBox>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QLocale>
#include <QLabel>
#include <QtMath>
#include <QDateTime>
#include <QTimeEdit>
#include <QTime>
#include "settings.h"
@ -93,6 +90,42 @@ EditProgDlg::EditProgDlg(struct Program &p, QWidget *parent, Qt::WindowFlags f)
dowLayout->addWidget(dow_btn[i], 0, Qt::AlignHCenter);
}
// ************* start time ******************
QHBoxLayout *startTimeLayout = new QHBoxLayout;
QLabel *start_time_label = new QLabel(QString(tr("Start time:")));
set_font(start_time_label);
QTimeEdit *start_time_widget = new QTimeEdit(p.start_time);
sheet = QString("QTimeEdit { height: %1px; font-size: %4px }"
"QTimeEdit::up-button { width: %2px; height: %3px }"
"QTimeEdit::down-button { width: %2px; height: %3px }")
.arg(2*SPIN_ARROW_H)
.arg(SPIN_ARROW_W)
.arg(SPIN_ARROW_H)
.arg(SPIN_FONT_SZ);
start_time_widget->setStyleSheet(sheet);
startTimeLayout->addWidget(start_time_label);
startTimeLayout->addWidget(start_time_widget);
// ************* end time ******************
QHBoxLayout *endTimeLayout = new QHBoxLayout;
QLabel *end_time_label = new QLabel(QString(tr("End time:")));
set_font(end_time_label);
QTimeEdit *end_time_widget = new QTimeEdit(p.end_time);
sheet = QString("QTimeEdit { height: %1px; font-size: %4px }"
"QTimeEdit::up-button { width: %2px; height: %3px }"
"QTimeEdit::down-button { width: %2px; height: %3px }")
.arg(2*SPIN_ARROW_H)
.arg(SPIN_ARROW_W)
.arg(SPIN_ARROW_H)
.arg(SPIN_FONT_SZ);
end_time_widget->setStyleSheet(sheet);
endTimeLayout->addWidget(end_time_label);
endTimeLayout->addWidget(end_time_widget);
// ************* OK / CANCEL Buttons ******************
set_font(ok_btn);
set_font(cancel_btn);
@ -114,6 +147,10 @@ EditProgDlg::EditProgDlg(struct Program &p, QWidget *parent, Qt::WindowFlags f)
topLayout->addLayout(dowLayout);
topLayout->addLayout(startTimeLayout);
topLayout->addLayout(endTimeLayout);
topLayout->addLayout(btnLayout);
this->setLayout(topLayout);


Loading…
Cancel
Save