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

Auto status change to "Under Review"

You need to be logged in to leave comments. Login now