##// END OF EJS Templates
Adds a name for a tab...
Alexandre Leroux -
r198:2c59e95cf3ce
parent child
Show More
@@ -3,6 +3,8
3 3
4 4 #include "Visualization/IVisualizationWidget.h"
5 5
6 #include <Common/spimpl.h>
7
6 8 #include <QWidget>
7 9
8 10 class VisualizationZoneWidget;
@@ -15,7 +17,7 class VisualizationTabWidget : public QWidget, public IVisualizationWidget {
15 17 Q_OBJECT
16 18
17 19 public:
18 explicit VisualizationTabWidget(QWidget *parent = 0);
20 explicit VisualizationTabWidget(const QString &name = {}, QWidget *parent = 0);
19 21 virtual ~VisualizationTabWidget();
20 22
21 23 /// Add a zone widget
@@ -34,6 +36,9 public:
34 36
35 37 private:
36 38 Ui::VisualizationTabWidget *ui;
39
40 class VisualizationTabWidgetPrivate;
41 spimpl::unique_impl_ptr<VisualizationTabWidgetPrivate> impl;
37 42 };
38 43
39 44 #endif // SCIQLOP_VISUALIZATIONTABWIDGET_H
@@ -3,9 +3,16
3 3
4 4 #include "Visualization/VisualizationZoneWidget.h"
5 5
6 struct VisualizationTabWidget::VisualizationTabWidgetPrivate {
7 explicit VisualizationTabWidgetPrivate(const QString &name) : m_Name{name} {}
6 8
7 VisualizationTabWidget::VisualizationTabWidget(QWidget *parent)
8 : QWidget{parent}, ui{new Ui::VisualizationTabWidget}
9 QString m_Name;
10 };
11
12 VisualizationTabWidget::VisualizationTabWidget(const QString &name, QWidget *parent)
13 : QWidget{parent},
14 ui{new Ui::VisualizationTabWidget},
15 impl{spimpl::make_unique_impl<VisualizationTabWidgetPrivate>(name)}
9 16 {
10 17 ui->setupUi(this);
11 18 }
@@ -45,5 +52,5 void VisualizationTabWidget::close()
45 52
46 53 QString VisualizationTabWidget::name() const
47 54 {
48 return QStringLiteral("MainView");
55 return impl->m_Name;
49 56 }
@@ -32,8 +32,9 VisualizationWidget::VisualizationWidget(QWidget *parent)
32 32 };
33 33
34 34 auto addTabView = [this, enableMinimumCornerWidgetSize]() {
35 auto index = ui->tabWidget->addTab(new VisualizationTabWidget(ui->tabWidget),
36 QString("View %1").arg(ui->tabWidget->count() + 1));
35 auto widget = new VisualizationTabWidget{QString{"View %1"}.arg(ui->tabWidget->count() + 1),
36 ui->tabWidget};
37 auto index = ui->tabWidget->addTab(widget, widget->name());
37 38 if (ui->tabWidget->count() > 0) {
38 39 enableMinimumCornerWidgetSize(false);
39 40 }
General Comments 0
You need to be logged in to leave comments. Login now