TimeWidget.cpp
29 lines
| 789 B
| text/x-c
|
CppLexer
r134 | #include "TimeWidget/TimeWidget.h" | |||
#include "ui_TimeWidget.h" | ||||
r192 | ||||
r134 | TimeWidget::TimeWidget(QWidget *parent) : QWidget{parent}, ui{new Ui::TimeWidget} | |||
{ | ||||
ui->setupUi(this); | ||||
r192 | ||||
// Connection | ||||
connect(ui->startDateTimeEdit, &QDateTimeEdit::dateTimeChanged, this, | ||||
&TimeWidget::onTimeUpdateRequested); | ||||
connect(ui->endDateTimeEdit, &QDateTimeEdit::dateTimeChanged, this, | ||||
&TimeWidget::onTimeUpdateRequested); | ||||
r134 | } | |||
TimeWidget::~TimeWidget() | ||||
{ | ||||
delete ui; | ||||
} | ||||
r192 | ||||
void TimeWidget::onTimeUpdateRequested() | ||||
{ | ||||
auto dateTime = SqpDateTime{ | ||||
static_cast<double>(ui->startDateTimeEdit->dateTime().toMSecsSinceEpoch() / 1000.), | ||||
static_cast<double>(ui->endDateTimeEdit->dateTime().toMSecsSinceEpoch()) / 1000.}; | ||||
emit timeUpdated(std::move(dateTime)); | ||||
} | ||||