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