##// END OF EJS Templates
add TimeWidget connection
perrinel -
r178:274725519804
parent child
Show More
@@ -26,6 +26,7
26 26 #include <DataSource/DataSourceWidget.h>
27 27 #include <SidePane/SqpSidePane.h>
28 28 #include <SqpApplication.h>
29 #include <Time/TimeController.h>
29 30 #include <TimeWidget/TimeWidget.h>
30 31 #include <Variable/Variable.h>
31 32 #include <Visualization/VisualizationController.h>
@@ -168,12 +169,20 MainWindow::MainWindow(QWidget *parent)
168 169 this->menuBar()->addAction(tr("File"));
169 170 auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar"));
170 171
171 mainToolBar->addWidget(new TimeWidget{});
172 auto timeWidget = new TimeWidget{};
173 mainToolBar->addWidget(timeWidget);
172 174
173 175 // Widgets / controllers connections
176
177 // DataSource
174 178 connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)),
175 179 m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *)));
176 180
181 // Time
182 connect(timeWidget, SIGNAL(timeUpdated(SqpDateTime)), &sqpApp->timeController(),
183 SLOT(onTimeToUpdate(SqpDateTime)));
184
185 // Variable
177 186 qRegisterMetaType<std::shared_ptr<Variable> >();
178 187 connect(&sqpApp->visualizationController(), SIGNAL(variableCreated(std::shared_ptr<Variable>)),
179 188 m_Ui->view, SLOT(displayVariable(std::shared_ptr<Variable>)));
@@ -3,6 +3,8
3 3
4 4 #include <QWidget>
5 5
6 #include <Data/SqpDateTime.h>
7
6 8 namespace Ui {
7 9 class TimeWidget;
8 10 } // Ui
@@ -14,6 +16,15 public:
14 16 explicit TimeWidget(QWidget *parent = 0);
15 17 virtual ~TimeWidget();
16 18
19 signals:
20 /// Signal emitted when the time parameters has beed updated
21 void timeUpdated(SqpDateTime time);
22
23 public slots:
24 /// slot called when time parameters update has ben requested
25 void onTimeUpdateRequested();
26
27
17 28 private:
18 29 Ui::TimeWidget *ui;
19 30 };
@@ -1,12 +1,29
1 1 #include "TimeWidget/TimeWidget.h"
2 2 #include "ui_TimeWidget.h"
3 3
4
4 5 TimeWidget::TimeWidget(QWidget *parent) : QWidget{parent}, ui{new Ui::TimeWidget}
5 6 {
6 7 ui->setupUi(this);
8
9 // Connection
10 connect(ui->startDateTimeEdit, &QDateTimeEdit::dateTimeChanged, this,
11 &TimeWidget::onTimeUpdateRequested);
12
13 connect(ui->endDateTimeEdit, &QDateTimeEdit::dateTimeChanged, this,
14 &TimeWidget::onTimeUpdateRequested);
7 15 }
8 16
9 17 TimeWidget::~TimeWidget()
10 18 {
11 19 delete ui;
12 20 }
21
22 void TimeWidget::onTimeUpdateRequested()
23 {
24 auto dateTime = SqpDateTime{
25 static_cast<double>(ui->startDateTimeEdit->dateTime().toMSecsSinceEpoch() / 1000.),
26 static_cast<double>(ui->endDateTimeEdit->dateTime().toMSecsSinceEpoch()) / 1000.};
27
28 emit timeUpdated(std::move(dateTime));
29 }
General Comments 4
Under Review
author

Pull request updated. Auto status change to "Under Review"

Changed commits:
  * 1 added
  * 0 removed

Changed files:
  * M gui/include/Visualization/VisualizationGraphWidget.h
  * M gui/src/Visualization/VisualizationGraphWidget.cpp
Approved
author

Status change > Approved

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