##// END OF EJS Templates
Adds a name for a zone...
Alexandre Leroux -
r183:7a2695cdaeea
parent child
Show More
@@ -1,39 +1,39
1 #ifndef SCIQLOP_VISUALIZATIONZONEWIDGET_H
1 #ifndef SCIQLOP_VISUALIZATIONZONEWIDGET_H
2 #define SCIQLOP_VISUALIZATIONZONEWIDGET_H
2 #define SCIQLOP_VISUALIZATIONZONEWIDGET_H
3
3
4 #include "Visualization/IVisualizationWidget.h"
4 #include "Visualization/IVisualizationWidget.h"
5
5
6 class VisualizationGraphWidget;
7
8 #include <QWidget>
6 #include <QWidget>
9
7
10 namespace Ui {
8 namespace Ui {
11 class VisualizationZoneWidget;
9 class VisualizationZoneWidget;
12 } // Ui
10 } // Ui
13
11
12 class VisualizationGraphWidget;
13
14 class VisualizationZoneWidget : public QWidget, public IVisualizationWidget {
14 class VisualizationZoneWidget : public QWidget, public IVisualizationWidget {
15 Q_OBJECT
15 Q_OBJECT
16
16
17 public:
17 public:
18 explicit VisualizationZoneWidget(QWidget *parent = 0);
18 explicit VisualizationZoneWidget(const QString &name = {}, QWidget *parent = 0);
19 virtual ~VisualizationZoneWidget();
19 virtual ~VisualizationZoneWidget();
20
20
21 /// Add a graph widget
21 /// Add a graph widget
22 void addGraph(VisualizationGraphWidget *graphWidget);
22 void addGraph(VisualizationGraphWidget *graphWidget);
23
23
24 /// Create a graph using a Variable
24 /// Create a graph using a Variable
25 VisualizationGraphWidget *createGraph();
25 VisualizationGraphWidget *createGraph();
26
26
27 /// Remove a graph
27 /// Remove a graph
28 void removeGraph(VisualizationGraphWidget *graph);
28 void removeGraph(VisualizationGraphWidget *graph);
29
29
30 // IVisualizationWidget interface
30 // IVisualizationWidget interface
31 void accept(IVisualizationWidget *visitor) override;
31 void accept(IVisualizationWidget *visitor) override;
32 void close() override;
32 void close() override;
33 QString name() const override;
33 QString name() const override;
34
34
35 private:
35 private:
36 Ui::VisualizationZoneWidget *ui;
36 Ui::VisualizationZoneWidget *ui;
37 };
37 };
38
38
39 #endif // SCIQLOP_VISUALIZATIONZONEWIDGET_H
39 #endif // SCIQLOP_VISUALIZATIONZONEWIDGET_H
@@ -1,48 +1,50
1 #include "Visualization/VisualizationZoneWidget.h"
1 #include "Visualization/VisualizationZoneWidget.h"
2 #include "ui_VisualizationZoneWidget.h"
2 #include "ui_VisualizationZoneWidget.h"
3
3
4 #include "Visualization/VisualizationGraphWidget.h"
4 #include "Visualization/VisualizationGraphWidget.h"
5
5
6 VisualizationZoneWidget::VisualizationZoneWidget(QWidget *parent)
6 VisualizationZoneWidget::VisualizationZoneWidget(const QString &name, QWidget *parent)
7 : QWidget{parent}, ui{new Ui::VisualizationZoneWidget}
7 : QWidget{parent}, ui{new Ui::VisualizationZoneWidget}
8 {
8 {
9 ui->setupUi(this);
9 ui->setupUi(this);
10
11 ui->zoneNameLabel->setText(name);
10 }
12 }
11
13
12 VisualizationZoneWidget::~VisualizationZoneWidget()
14 VisualizationZoneWidget::~VisualizationZoneWidget()
13 {
15 {
14 delete ui;
16 delete ui;
15 }
17 }
16
18
17 void VisualizationZoneWidget::addGraph(VisualizationGraphWidget *graphWidget)
19 void VisualizationZoneWidget::addGraph(VisualizationGraphWidget *graphWidget)
18 {
20 {
19 ui->visualizationZoneFrame->layout()->addWidget(graphWidget);
21 ui->visualizationZoneFrame->layout()->addWidget(graphWidget);
20 }
22 }
21
23
22 VisualizationGraphWidget *VisualizationZoneWidget::createGraph()
24 VisualizationGraphWidget *VisualizationZoneWidget::createGraph()
23 {
25 {
24 auto graphWidget = new VisualizationGraphWidget{this};
26 auto graphWidget = new VisualizationGraphWidget{this};
25 this->addGraph(graphWidget);
27 this->addGraph(graphWidget);
26
28
27 return graphWidget;
29 return graphWidget;
28 }
30 }
29
31
30 void VisualizationZoneWidget::removeGraph(VisualizationGraphWidget *graph)
32 void VisualizationZoneWidget::removeGraph(VisualizationGraphWidget *graph)
31 {
33 {
32 }
34 }
33
35
34 void VisualizationZoneWidget::accept(IVisualizationWidget *visitor)
36 void VisualizationZoneWidget::accept(IVisualizationWidget *visitor)
35 {
37 {
36 // TODO: manage the visitor
38 // TODO: manage the visitor
37 }
39 }
38
40
39 void VisualizationZoneWidget::close()
41 void VisualizationZoneWidget::close()
40 {
42 {
41 // The main view cannot be directly closed.
43 // The main view cannot be directly closed.
42 return;
44 return;
43 }
45 }
44
46
45 QString VisualizationZoneWidget::name() const
47 QString VisualizationZoneWidget::name() const
46 {
48 {
47 return QStringLiteral("MainView");
49 return ui->zoneNameLabel->text();
48 }
50 }
@@ -1,50 +1,76
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <ui version="4.0">
2 <ui version="4.0">
3 <class>VisualizationZoneWidget</class>
3 <class>VisualizationZoneWidget</class>
4 <widget class="QWidget" name="VisualizationZoneWidget">
4 <widget class="QWidget" name="VisualizationZoneWidget">
5 <property name="geometry">
5 <property name="geometry">
6 <rect>
6 <rect>
7 <x>0</x>
7 <x>0</x>
8 <y>0</y>
8 <y>0</y>
9 <width>400</width>
9 <width>400</width>
10 <height>300</height>
10 <height>300</height>
11 </rect>
11 </rect>
12 </property>
12 </property>
13 <property name="windowTitle">
13 <property name="windowTitle">
14 <string>Form</string>
14 <string>Form</string>
15 </property>
15 </property>
16 <layout class="QVBoxLayout" name="verticalLayout_2">
16 <layout class="QVBoxLayout" name="verticalLayout_2">
17 <property name="spacing">
17 <item>
18 <number>3</number>
18 <widget class="QWidget" name="infobar" native="true">
19 </property>
19 <property name="sizePolicy">
20 <property name="leftMargin">
20 <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
21 <number>0</number>
21 <horstretch>0</horstretch>
22 </property>
22 <verstretch>0</verstretch>
23 <property name="topMargin">
23 </sizepolicy>
24 <number>0</number>
24 </property>
25 </property>
25 <layout class="QHBoxLayout" name="horizontalLayout">
26 <property name="rightMargin">
26 <property name="leftMargin">
27 <number>0</number>
27 <number>0</number>
28 </property>
28 </property>
29 <property name="bottomMargin">
29 <property name="topMargin">
30 <number>0</number>
30 <number>0</number>
31 </property>
31 </property>
32 <property name="rightMargin">
33 <number>0</number>
34 </property>
35 <property name="bottomMargin">
36 <number>0</number>
37 </property>
38 <item>
39 <widget class="QLabel" name="zoneNameLabel">
40 <property name="styleSheet">
41 <string notr="true">color: rgb(127, 127, 127);
42 </string>
43 </property>
44 <property name="text">
45 <string>TextLabel</string>
46 </property>
47 </widget>
48 </item>
49 </layout>
50 </widget>
51 </item>
32 <item>
52 <item>
33 <widget class="QFrame" name="visualizationZoneFrame">
53 <widget class="QFrame" name="visualizationZoneFrame">
54 <property name="sizePolicy">
55 <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
56 <horstretch>0</horstretch>
57 <verstretch>0</verstretch>
58 </sizepolicy>
59 </property>
34 <property name="frameShape">
60 <property name="frameShape">
35 <enum>QFrame::Box</enum>
61 <enum>QFrame::Box</enum>
36 </property>
62 </property>
37 <property name="frameShadow">
63 <property name="frameShadow">
38 <enum>QFrame::Raised</enum>
64 <enum>QFrame::Raised</enum>
39 </property>
65 </property>
40 <property name="lineWidth">
66 <property name="lineWidth">
41 <number>1</number>
67 <number>1</number>
42 </property>
68 </property>
43 <layout class="QVBoxLayout" name="verticalLayout"/>
69 <layout class="QVBoxLayout" name="verticalLayout"/>
44 </widget>
70 </widget>
45 </item>
71 </item>
46 </layout>
72 </layout>
47 </widget>
73 </widget>
48 <resources/>
74 <resources/>
49 <connections/>
75 <connections/>
50 </ui>
76 </ui>
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