##// END OF EJS Templates
Adds logs for null visitors
Alexandre Leroux -
r204:5c097ba3f0d9
parent child
Show More
@@ -1,44 +1,47
1 1 #ifndef SCIQLOP_VISUALIZATIONGRAPHWIDGET_H
2 2 #define SCIQLOP_VISUALIZATIONGRAPHWIDGET_H
3 3
4 4 #include "Visualization/IVisualizationWidget.h"
5 5
6 #include <QLoggingCategory>
6 7 #include <QWidget>
7 8
8 9 #include <memory>
9 10
10 11 #include <Common/spimpl.h>
11 12
13 Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationGraphWidget)
14
12 15 class Variable;
13 16
14 17 namespace Ui {
15 18 class VisualizationGraphWidget;
16 19 } // namespace Ui
17 20
18 21 class VisualizationGraphWidget : public QWidget, public IVisualizationWidget {
19 22 Q_OBJECT
20 23
21 24 public:
22 25 explicit VisualizationGraphWidget(const QString &name = {}, QWidget *parent = 0);
23 26 virtual ~VisualizationGraphWidget();
24 27
25 28 void addVariable(std::shared_ptr<Variable> variable);
26 29
27 30 // IVisualizationWidget interface
28 31 void accept(IVisualizationWidgetVisitor *visitor) override;
29 32 bool canDrop(const Variable &variable) const override;
30 33 void close() override;
31 34 QString name() const override;
32 35
33 36 private:
34 37 Ui::VisualizationGraphWidget *ui;
35 38
36 39 class VisualizationGraphWidgetPrivate;
37 40 spimpl::unique_impl_ptr<VisualizationGraphWidgetPrivate> impl;
38 41
39 42 private slots:
40 43 /// Slot called when a mouse wheel was made, to perform some processing before the zoom is done
41 44 void onMouseWheel(QWheelEvent *event) noexcept;
42 45 };
43 46
44 47 #endif // SCIQLOP_VISUALIZATIONGRAPHWIDGET_H
@@ -1,51 +1,54
1 1 #ifndef SCIQLOP_VISUALIZATIONTABWIDGET_H
2 2 #define SCIQLOP_VISUALIZATIONTABWIDGET_H
3 3
4 4 #include "Visualization/IVisualizationWidget.h"
5 5
6 6 #include <Common/spimpl.h>
7 7
8 #include <QLoggingCategory>
8 9 #include <QWidget>
9 10
11 Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationTabWidget)
12
10 13 class Variable;
11 14 class VisualizationZoneWidget;
12 15
13 16 namespace Ui {
14 17 class VisualizationTabWidget;
15 18 } // namespace Ui
16 19
17 20 class VisualizationTabWidget : public QWidget, public IVisualizationWidget {
18 21 Q_OBJECT
19 22
20 23 public:
21 24 explicit VisualizationTabWidget(const QString &name = {}, QWidget *parent = 0);
22 25 virtual ~VisualizationTabWidget();
23 26
24 27 /// Add a zone widget
25 28 void addZone(VisualizationZoneWidget *zoneWidget);
26 29
27 30 /**
28 31 * Creates a zone using a variable. The variable will be displayed in a new graph of the new
29 32 * zone.
30 33 * @param variable the variable for which to create the zone
31 34 * @return the pointer to the created zone
32 35 */
33 36 VisualizationZoneWidget *createZone(std::shared_ptr<Variable> variable);
34 37
35 38 /// Remove a zone
36 39 void removeZone(VisualizationZoneWidget *zone);
37 40
38 41 // IVisualizationWidget interface
39 42 void accept(IVisualizationWidgetVisitor *visitor) override;
40 43 bool canDrop(const Variable &variable) const override;
41 44 void close() override;
42 45 QString name() const override;
43 46
44 47 private:
45 48 Ui::VisualizationTabWidget *ui;
46 49
47 50 class VisualizationTabWidgetPrivate;
48 51 spimpl::unique_impl_ptr<VisualizationTabWidgetPrivate> impl;
49 52 };
50 53
51 54 #endif // SCIQLOP_VISUALIZATIONTABWIDGET_H
@@ -1,53 +1,53
1 1 #ifndef SCIQLOP_VISUALIZATIONWIDGET_H
2 2 #define SCIQLOP_VISUALIZATIONWIDGET_H
3 3
4 4 #include "Visualization/IVisualizationWidget.h"
5 5
6 6 #include <QLoggingCategory>
7 7 #include <QWidget>
8 8
9 Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationWidget)
10
9 11 class Variable;
10 12 class VisualizationTabWidget;
11 13
12 Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationWidget)
13
14 14 namespace Ui {
15 15 class VisualizationWidget;
16 16 } // namespace Ui
17 17
18 18 class VisualizationWidget : public QWidget, public IVisualizationWidget {
19 19 Q_OBJECT
20 20
21 21 public:
22 22 explicit VisualizationWidget(QWidget *parent = 0);
23 23 virtual ~VisualizationWidget();
24 24
25 25 /// Add a zone widget
26 26 virtual void addTab(VisualizationTabWidget *tabWidget);
27 27
28 28 /// Create a tab using a Variable
29 29 VisualizationTabWidget *createTab();
30 30
31 31 /// Remove a tab
32 32 void removeTab(VisualizationTabWidget *tab);
33 33
34 34 // IVisualizationWidget interface
35 35 void accept(IVisualizationWidgetVisitor *visitor) override;
36 36 bool canDrop(const Variable &variable) const override;
37 37 void close() override;
38 38 QString name() const override;
39 39
40 40 public slots:
41 41 /**
42 42 * Displays a variable in a new graph of a new zone of the current tab
43 43 * @param variable the variable to display
44 44 * @todo this is a temporary method that will be replaced by own actions for each type of
45 45 * visualization widget
46 46 */
47 47 void displayVariable(std::shared_ptr<Variable> variable) noexcept;
48 48
49 49 private:
50 50 Ui::VisualizationWidget *ui;
51 51 };
52 52
53 53 #endif // VISUALIZATIONWIDGET_H
@@ -1,45 +1,48
1 1 #ifndef SCIQLOP_VISUALIZATIONZONEWIDGET_H
2 2 #define SCIQLOP_VISUALIZATIONZONEWIDGET_H
3 3
4 4 #include "Visualization/IVisualizationWidget.h"
5 5
6 #include <QLoggingCategory>
6 7 #include <QWidget>
7 8
9 Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationZoneWidget)
10
8 11 namespace Ui {
9 12 class VisualizationZoneWidget;
10 13 } // Ui
11 14
12 15 class Variable;
13 16 class VisualizationGraphWidget;
14 17
15 18 class VisualizationZoneWidget : public QWidget, public IVisualizationWidget {
16 19 Q_OBJECT
17 20
18 21 public:
19 22 explicit VisualizationZoneWidget(const QString &name = {}, QWidget *parent = 0);
20 23 virtual ~VisualizationZoneWidget();
21 24
22 25 /// Add a graph widget
23 26 void addGraph(VisualizationGraphWidget *graphWidget);
24 27
25 28 /**
26 29 * Creates a graph using a variable. The variable will be displayed in the new graph.
27 30 * @param variable the variable for which to create the graph
28 31 * @return the pointer to the created graph
29 32 */
30 33 VisualizationGraphWidget *createGraph(std::shared_ptr<Variable> variable);
31 34
32 35 /// Remove a graph
33 36 void removeGraph(VisualizationGraphWidget *graph);
34 37
35 38 // IVisualizationWidget interface
36 39 void accept(IVisualizationWidgetVisitor *visitor) override;
37 40 bool canDrop(const Variable &variable) const override;
38 41 void close() override;
39 42 QString name() const override;
40 43
41 44 private:
42 45 Ui::VisualizationZoneWidget *ui;
43 46 };
44 47
45 48 #endif // SCIQLOP_VISUALIZATIONZONEWIDGET_H
@@ -1,105 +1,111
1 1 #include "Visualization/VisualizationGraphWidget.h"
2 2 #include "Visualization/GraphPlottablesFactory.h"
3 3 #include "Visualization/IVisualizationWidgetVisitor.h"
4 4 #include "ui_VisualizationGraphWidget.h"
5 5
6 6 #include <Variable/Variable.h>
7 7
8 8 #include <unordered_map>
9 9
10 Q_LOGGING_CATEGORY(LOG_VisualizationGraphWidget, "VisualizationGraphWidget")
11
10 12 namespace {
11 13
12 14 /// Key pressed to enable zoom on horizontal axis
13 15 const auto HORIZONTAL_ZOOM_MODIFIER = Qt::NoModifier;
14 16
15 17 /// Key pressed to enable zoom on vertical axis
16 18 const auto VERTICAL_ZOOM_MODIFIER = Qt::ControlModifier;
17 19
18 20 } // namespace
19 21
20 22 struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate {
21 23
22 24 // 1 variable -> n qcpplot
23 25 std::unordered_map<std::shared_ptr<Variable>, QCPAbstractPlottable *> m_VariableToPlotMap;
24 26 };
25 27
26 28 VisualizationGraphWidget::VisualizationGraphWidget(const QString &name, QWidget *parent)
27 29 : QWidget{parent},
28 30 ui{new Ui::VisualizationGraphWidget},
29 31 impl{spimpl::make_unique_impl<VisualizationGraphWidgetPrivate>()}
30 32 {
31 33 ui->setupUi(this);
32 34
33 35 // qcpplot title
34 36 ui->widget->plotLayout()->insertRow(0);
35 37 ui->widget->plotLayout()->addElement(0, 0, new QCPTextElement{ui->widget, name});
36 38
37 39 // Set qcpplot properties :
38 40 // - Drag (on x-axis) and zoom are enabled
39 41 // - Mouse wheel on qcpplot is intercepted to determine the zoom orientation
40 42 ui->widget->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
41 43 ui->widget->axisRect()->setRangeDrag(Qt::Horizontal);
42 44 connect(ui->widget, &QCustomPlot::mouseWheel, this, &VisualizationGraphWidget::onMouseWheel);
43 45 }
44 46
45 47 VisualizationGraphWidget::~VisualizationGraphWidget()
46 48 {
47 49 delete ui;
48 50 }
49 51
50 52 void VisualizationGraphWidget::addVariable(std::shared_ptr<Variable> variable)
51 53 {
52 54 // Uses delegate to create the qcpplot components according to the variable
53 55 auto createdPlottables = GraphPlottablesFactory::create(variable, *ui->widget);
54 56
55 57 for (auto createdPlottable : qAsConst(createdPlottables)) {
56 58 impl->m_VariableToPlotMap.insert({variable, createdPlottable});
57 59 }
58 60 }
59 61
60 62 void VisualizationGraphWidget::accept(IVisualizationWidgetVisitor *visitor)
61 63 {
62 64 if (visitor) {
63 65 visitor->visit(this);
64 66 }
67 else {
68 qCCritical(LOG_VisualizationGraphWidget())
69 << tr("Can't visit widget : the visitor is null");
70 }
65 71 }
66 72
67 73 bool VisualizationGraphWidget::canDrop(const Variable &variable) const
68 74 {
69 75 /// @todo : for the moment, a graph can always accomodate a variable
70 76 Q_UNUSED(variable);
71 77 return true;
72 78 }
73 79
74 80 void VisualizationGraphWidget::close()
75 81 {
76 82 // The main view cannot be directly closed.
77 83 return;
78 84 }
79 85
80 86 QString VisualizationGraphWidget::name() const
81 87 {
82 88 if (auto title = dynamic_cast<QCPTextElement *>(ui->widget->plotLayout()->elementAt(0))) {
83 89 return title->text();
84 90 }
85 91 else {
86 92 return QString{};
87 93 }
88 94 }
89 95
90 96 void VisualizationGraphWidget::onMouseWheel(QWheelEvent *event) noexcept
91 97 {
92 98 auto zoomOrientations = QFlags<Qt::Orientation>{};
93 99
94 100 // Lambda that enables a zoom orientation if the key modifier related to this orientation has
95 101 // been pressed
96 102 auto enableOrientation
97 103 = [&zoomOrientations, event](const auto &orientation, const auto &modifier) {
98 104 auto orientationEnabled = event->modifiers().testFlag(modifier);
99 105 zoomOrientations.setFlag(orientation, orientationEnabled);
100 106 };
101 107 enableOrientation(Qt::Vertical, VERTICAL_ZOOM_MODIFIER);
102 108 enableOrientation(Qt::Horizontal, HORIZONTAL_ZOOM_MODIFIER);
103 109
104 110 ui->widget->axisRect()->setRangeZoom(zoomOrientations);
105 111 }
@@ -1,99 +1,104
1 1 #include "Visualization/VisualizationTabWidget.h"
2 2 #include "Visualization/IVisualizationWidgetVisitor.h"
3 3 #include "ui_VisualizationTabWidget.h"
4 4
5 5 #include "Visualization/VisualizationZoneWidget.h"
6 6
7 Q_LOGGING_CATEGORY(LOG_VisualizationTabWidget, "VisualizationTabWidget")
8
7 9 namespace {
8 10
9 11 /// Generates a default name for a new zone, according to the number of zones already displayed in
10 12 /// the tab
11 13 QString defaultZoneName(const QLayout &layout)
12 14 {
13 15 auto count = 0;
14 16 for (auto i = 0; i < layout.count(); ++i) {
15 17 if (dynamic_cast<VisualizationZoneWidget *>(layout.itemAt(i)->widget())) {
16 18 count++;
17 19 }
18 20 }
19 21
20 22 return QObject::tr("Zone %1").arg(count + 1);
21 23 }
22 24
23 25 } // namespace
24 26
25 27 struct VisualizationTabWidget::VisualizationTabWidgetPrivate {
26 28 explicit VisualizationTabWidgetPrivate(const QString &name) : m_Name{name} {}
27 29
28 30 QString m_Name;
29 31 };
30 32
31 33 VisualizationTabWidget::VisualizationTabWidget(const QString &name, QWidget *parent)
32 34 : QWidget{parent},
33 35 ui{new Ui::VisualizationTabWidget},
34 36 impl{spimpl::make_unique_impl<VisualizationTabWidgetPrivate>(name)}
35 37 {
36 38 ui->setupUi(this);
37 39 }
38 40
39 41 VisualizationTabWidget::~VisualizationTabWidget()
40 42 {
41 43 delete ui;
42 44 }
43 45
44 46 void VisualizationTabWidget::addZone(VisualizationZoneWidget *zoneWidget)
45 47 {
46 48 this->layout()->addWidget(zoneWidget);
47 49 }
48 50
49 51 VisualizationZoneWidget *VisualizationTabWidget::createZone(std::shared_ptr<Variable> variable)
50 52 {
51 53 auto zoneWidget = new VisualizationZoneWidget{defaultZoneName(*layout()), this};
52 54 this->addZone(zoneWidget);
53 55
54 56 // Creates a new graph into the zone
55 57 zoneWidget->createGraph(variable);
56 58
57 59 return zoneWidget;
58 60 }
59 61
60 62 void VisualizationTabWidget::removeZone(VisualizationZoneWidget *zone)
61 63 {
62 64 }
63 65
64 66 void VisualizationTabWidget::accept(IVisualizationWidgetVisitor *visitor)
65 67 {
66 68 if (visitor) {
67 69 visitor->visitEnter(this);
68 70
69 71 // Apply visitor to zone children
70 72 for (auto i = 0; i < layout()->count(); ++i) {
71 73 if (auto item = layout()->itemAt(i)) {
72 74 if (auto visualizationZoneWidget
73 75 = dynamic_cast<VisualizationZoneWidget *>(item->widget())) {
74 76 visualizationZoneWidget->accept(visitor);
75 77 }
76 78 }
77 79 }
78 80
79 81 visitor->visitLeave(this);
80 82 }
83 else {
84 qCCritical(LOG_VisualizationTabWidget()) << tr("Can't visit widget : the visitor is null");
85 }
81 86 }
82 87
83 88 bool VisualizationTabWidget::canDrop(const Variable &variable) const
84 89 {
85 90 // A tab can always accomodate a variable
86 91 Q_UNUSED(variable);
87 92 return true;
88 93 }
89 94
90 95 void VisualizationTabWidget::close()
91 96 {
92 97 // The main view cannot be directly closed.
93 98 return;
94 99 }
95 100
96 101 QString VisualizationTabWidget::name() const
97 102 {
98 103 return impl->m_Name;
99 104 }
@@ -1,132 +1,135
1 1 #include "Visualization/VisualizationWidget.h"
2 2 #include "Visualization/IVisualizationWidgetVisitor.h"
3 3 #include "Visualization/VisualizationGraphWidget.h"
4 4 #include "Visualization/VisualizationTabWidget.h"
5 5 #include "Visualization/VisualizationZoneWidget.h"
6 6 #include "Visualization/qcustomplot.h"
7 7
8 8 #include "ui_VisualizationWidget.h"
9 9
10 10 #include <QToolButton>
11 11
12 12 Q_LOGGING_CATEGORY(LOG_VisualizationWidget, "VisualizationWidget")
13 13
14 14 VisualizationWidget::VisualizationWidget(QWidget *parent)
15 15 : QWidget{parent}, ui{new Ui::VisualizationWidget}
16 16 {
17 17 ui->setupUi(this);
18 18
19 19 auto addTabViewButton = new QToolButton{ui->tabWidget};
20 20 addTabViewButton->setText(tr("Add View"));
21 21 addTabViewButton->setCursor(Qt::ArrowCursor);
22 22 ui->tabWidget->setCornerWidget(addTabViewButton, Qt::TopRightCorner);
23 23
24 24 auto enableMinimumCornerWidgetSize = [this](bool enable) {
25 25
26 26 auto tabViewCornerWidget = ui->tabWidget->cornerWidget();
27 27 auto width = enable ? tabViewCornerWidget->width() : 0;
28 28 auto height = enable ? tabViewCornerWidget->height() : 0;
29 29 tabViewCornerWidget->setMinimumHeight(height);
30 30 tabViewCornerWidget->setMinimumWidth(width);
31 31 ui->tabWidget->setMinimumHeight(height);
32 32 ui->tabWidget->setMinimumWidth(width);
33 33 };
34 34
35 35 auto addTabView = [this, enableMinimumCornerWidgetSize]() {
36 36 auto widget = new VisualizationTabWidget{QString{"View %1"}.arg(ui->tabWidget->count() + 1),
37 37 ui->tabWidget};
38 38 auto index = ui->tabWidget->addTab(widget, widget->name());
39 39 if (ui->tabWidget->count() > 0) {
40 40 enableMinimumCornerWidgetSize(false);
41 41 }
42 42 qCInfo(LOG_VisualizationWidget()) << tr("add the tab of index %1").arg(index);
43 43 };
44 44
45 45 auto removeTabView = [this, enableMinimumCornerWidgetSize](int index) {
46 46 if (ui->tabWidget->count() == 1) {
47 47 enableMinimumCornerWidgetSize(true);
48 48 }
49 49
50 50 ui->tabWidget->removeTab(index);
51 51 qCInfo(LOG_VisualizationWidget()) << tr("remove the tab of index %1").arg(index);
52 52
53 53 };
54 54
55 55 ui->tabWidget->setTabsClosable(true);
56 56
57 57 connect(addTabViewButton, &QToolButton::clicked, addTabView);
58 58 connect(ui->tabWidget, &QTabWidget::tabCloseRequested, removeTabView);
59 59
60 60 // Adds default tab
61 61 addTabView();
62 62 }
63 63
64 64 VisualizationWidget::~VisualizationWidget()
65 65 {
66 66 delete ui;
67 67 }
68 68
69 69 void VisualizationWidget::addTab(VisualizationTabWidget *tabWidget)
70 70 {
71 71 // NOTE: check is this method has to be deleted because of its dupplicated version visible as
72 72 // lambda function (in the constructor)
73 73 }
74 74
75 75 VisualizationTabWidget *VisualizationWidget::createTab()
76 76 {
77 77 }
78 78
79 79 void VisualizationWidget::removeTab(VisualizationTabWidget *tab)
80 80 {
81 81 // NOTE: check is this method has to be deleted because of its dupplicated version visible as
82 82 // lambda function (in the constructor)
83 83 }
84 84
85 85 void VisualizationWidget::accept(IVisualizationWidgetVisitor *visitor)
86 86 {
87 87 if (visitor) {
88 88 visitor->visitEnter(this);
89 89
90 90 // Apply visitor for tab children
91 91 for (auto i = 0; i < ui->tabWidget->count(); ++i) {
92 92 if (auto visualizationTabWidget
93 93 = dynamic_cast<VisualizationTabWidget *>(ui->tabWidget->widget(i))) {
94 94 visualizationTabWidget->accept(visitor);
95 95 }
96 96 }
97 97
98 98 visitor->visitLeave(this);
99 99 }
100 else {
101 qCCritical(LOG_VisualizationWidget()) << tr("Can't visit widget : the visitor is null");
102 }
100 103 }
101 104
102 105 bool VisualizationWidget::canDrop(const Variable &variable) const
103 106 {
104 107 // The main widget can never accomodate a variable
105 108 Q_UNUSED(variable);
106 109 return false;
107 110 }
108 111
109 112 void VisualizationWidget::close()
110 113 {
111 114 // The main view cannot be directly closed.
112 115 return;
113 116 }
114 117
115 118 QString VisualizationWidget::name() const
116 119 {
117 120 return QStringLiteral("MainView");
118 121 }
119 122
120 123 void VisualizationWidget::displayVariable(std::shared_ptr<Variable> variable) noexcept
121 124 {
122 125 if (auto currentTab = dynamic_cast<VisualizationTabWidget *>(ui->tabWidget->currentWidget())) {
123 126 if (!currentTab->createZone(variable)) {
124 127 qCCritical(LOG_VisualizationWidget())
125 128 << tr("Can't display the variable : can't create a new zone in the current tab");
126 129 }
127 130 }
128 131 else {
129 132 qCCritical(LOG_VisualizationWidget())
130 133 << tr("Can't display the variable : there is no current tab");
131 134 }
132 135 }
@@ -1,94 +1,99
1 1 #include "Visualization/VisualizationZoneWidget.h"
2 2 #include "Visualization/IVisualizationWidgetVisitor.h"
3 3 #include "ui_VisualizationZoneWidget.h"
4 4
5 5 #include "Visualization/VisualizationGraphWidget.h"
6 6
7 Q_LOGGING_CATEGORY(LOG_VisualizationZoneWidget, "VisualizationZoneWidget")
8
7 9 namespace {
8 10
9 11 /// Generates a default name for a new graph, according to the number of graphs already displayed in
10 12 /// the zone
11 13 QString defaultGraphName(const QLayout &layout)
12 14 {
13 15 auto count = 0;
14 16 for (auto i = 0; i < layout.count(); ++i) {
15 17 if (dynamic_cast<VisualizationGraphWidget *>(layout.itemAt(i)->widget())) {
16 18 count++;
17 19 }
18 20 }
19 21
20 22 return QObject::tr("Graph %1").arg(count + 1);
21 23 }
22 24
23 25 } // namespace
24 26
25 27 VisualizationZoneWidget::VisualizationZoneWidget(const QString &name, QWidget *parent)
26 28 : QWidget{parent}, ui{new Ui::VisualizationZoneWidget}
27 29 {
28 30 ui->setupUi(this);
29 31
30 32 ui->zoneNameLabel->setText(name);
31 33 }
32 34
33 35 VisualizationZoneWidget::~VisualizationZoneWidget()
34 36 {
35 37 delete ui;
36 38 }
37 39
38 40 void VisualizationZoneWidget::addGraph(VisualizationGraphWidget *graphWidget)
39 41 {
40 42 ui->visualizationZoneFrame->layout()->addWidget(graphWidget);
41 43 }
42 44
43 45 VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<Variable> variable)
44 46 {
45 47 auto graphWidget = new VisualizationGraphWidget{
46 48 defaultGraphName(*ui->visualizationZoneFrame->layout()), this};
47 49 this->addGraph(graphWidget);
48 50
49 51 graphWidget->addVariable(variable);
50 52
51 53 return graphWidget;
52 54 }
53 55
54 56 void VisualizationZoneWidget::removeGraph(VisualizationGraphWidget *graph)
55 57 {
56 58 }
57 59
58 60 void VisualizationZoneWidget::accept(IVisualizationWidgetVisitor *visitor)
59 61 {
60 62 if (visitor) {
61 63 visitor->visitEnter(this);
62 64
63 65 // Apply visitor to graph children
64 66 auto layout = ui->visualizationZoneFrame->layout();
65 67 for (auto i = 0; i < layout->count(); ++i) {
66 68 if (auto item = layout->itemAt(i)) {
67 69 if (auto visualizationGraphWidget
68 70 = dynamic_cast<VisualizationGraphWidget *>(item->widget())) {
69 71 visualizationGraphWidget->accept(visitor);
70 72 }
71 73 }
72 74 }
73 75
74 76 visitor->visitLeave(this);
75 77 }
78 else {
79 qCCritical(LOG_VisualizationZoneWidget()) << tr("Can't visit widget : the visitor is null");
80 }
76 81 }
77 82
78 83 bool VisualizationZoneWidget::canDrop(const Variable &variable) const
79 84 {
80 85 // A tab can always accomodate a variable
81 86 Q_UNUSED(variable);
82 87 return true;
83 88 }
84 89
85 90 void VisualizationZoneWidget::close()
86 91 {
87 92 // The main view cannot be directly closed.
88 93 return;
89 94 }
90 95
91 96 QString VisualizationZoneWidget::name() const
92 97 {
93 98 return ui->zoneNameLabel->text();
94 99 }
General Comments 0
You need to be logged in to leave comments. Login now