##// END OF EJS Templates
Add apply button and its connection for timewidget
perrinel -
r302:c121d060318a
parent child
Show More
@@ -26,9 +26,12 signals:
26 26 void timeUpdated(SqpDateTime time);
27 27
28 28 public slots:
29 /// Slot called when a new dateTime has been defined. Call timeUpdated signal
29 /// Slot called when a new dateTime has been defined.
30 30 void onTimeToUpdate(SqpDateTime dateTime);
31 31
32 /// Slot called when the dateTime has to be notified. Call timeUpdated signal
33 void onTimeNotify();
34
32 35 private:
33 36 class TimeControllerPrivate;
34 37 spimpl::unique_impl_ptr<TimeControllerPrivate> impl;
@@ -21,6 +21,9 SqpDateTime TimeController::dateTime() const noexcept
21 21 void TimeController::onTimeToUpdate(SqpDateTime dateTime)
22 22 {
23 23 impl->m_DateTime = dateTime;
24 }
24 25
25 emit timeUpdated(dateTime);
26 void TimeController::onTimeNotify()
27 {
28 emit timeUpdated(impl->m_DateTime);
26 29 }
@@ -1,19 +1,28
1 1 #include "TimeWidget/TimeWidget.h"
2 2 #include "ui_TimeWidget.h"
3 3
4 #include <SqpApplication.h>
5 #include <Time/TimeController.h>
4 6
5 7 TimeWidget::TimeWidget(QWidget *parent) : QWidget{parent}, ui{new Ui::TimeWidget}
6 8 {
7 9 ui->setupUi(this);
8 10
11 ui->applyToolButton->setIcon(sqpApp->style()->standardIcon(QStyle::SP_DialogApplyButton));
12
9 13 // Connection
10 14 connect(ui->startDateTimeEdit, &QDateTimeEdit::dateTimeChanged, this,
11 15 &TimeWidget::onTimeUpdateRequested);
12 16
13 17 connect(ui->endDateTimeEdit, &QDateTimeEdit::dateTimeChanged, this,
14 18 &TimeWidget::onTimeUpdateRequested);
19
20
21 connect(ui->applyToolButton, &QToolButton::clicked, &sqpApp->timeController(),
22 &TimeController::onTimeNotify);
15 23 }
16 24
25
17 26 TimeWidget::~TimeWidget()
18 27 {
19 28 delete ui;
@@ -78,6 +78,13
78 78 </property>
79 79 </widget>
80 80 </item>
81 <item>
82 <widget class="QToolButton" name="applyToolButton">
83 <property name="text">
84 <string>...</string>
85 </property>
86 </widget>
87 </item>
81 88 </layout>
82 89 </widget>
83 90 <resources/>
General Comments 0
You need to be logged in to leave comments. Login now