##// END OF EJS Templates
Creates the data source widget...
Alexandre Leroux -
r82:8a7c6c676eea
parent child
Show More
@@ -0,0 +1,25
1 #ifndef SCIQLOP_DATASOURCEWIDGET_H
2 #define SCIQLOP_DATASOURCEWIDGET_H
3
4 #include <Common/spimpl.h>
5
6 #include <QWidget>
7
8 class DataSourceItem;
9
10 /**
11 * @brief The DataSourceWidget handles the graphical representation (as a tree) of the data sources
12 * attached to SciQlop.
13 */
14 class DataSourceWidget : public QWidget {
15 Q_OBJECT
16
17 public:
18 explicit DataSourceWidget(QWidget *parent = 0);
19
20 private:
21 class DataSourceWidgetPrivate;
22 spimpl::unique_impl_ptr<DataSourceWidgetPrivate> impl;
23 };
24
25 #endif // SCIQLOP_DATASOURCEWIDGET_H
@@ -0,0 +1,36
1 #include <DataSource/DataSourceWidget.h>
2
3 #include <ui_DataSourceWidget.h>
4
5 #include <DataSource/DataSourceItem.h>
6 #include <DataSource/DataSourceTreeWidgetItem.h>
7
8 namespace {
9
10 /// Number of columns displayed in the tree
11 const auto TREE_NB_COLUMNS = 1;
12
13 /// Header labels for the tree
14 const auto TREE_HEADER_LABELS = QStringList{QObject::tr("Name")};
15
16 } // namespace
17
18 class DataSourceWidget::DataSourceWidgetPrivate {
19 public:
20 explicit DataSourceWidgetPrivate(DataSourceWidget &widget)
21 : m_Ui{std::make_unique<Ui::DataSourceWidget>()}
22 {
23 m_Ui->setupUi(&widget);
24
25 // Set tree properties
26 m_Ui->treeWidget->setColumnCount(TREE_NB_COLUMNS);
27 m_Ui->treeWidget->setHeaderLabels(TREE_HEADER_LABELS);
28 }
29
30 std::unique_ptr<Ui::DataSourceWidget> m_Ui;
31 };
32
33 DataSourceWidget::DataSourceWidget(QWidget *parent)
34 : QWidget{parent}, impl{spimpl::make_unique_impl<DataSourceWidgetPrivate>(*this)}
35 {
36 }
@@ -0,0 +1,24
1 <?xml version="1.0" encoding="UTF-8"?>
2 <ui version="4.0">
3 <class>DataSourceWidget</class>
4 <widget class="QWidget" name="DataSourceWidget">
5 <property name="geometry">
6 <rect>
7 <x>0</x>
8 <y>0</y>
9 <width>400</width>
10 <height>300</height>
11 </rect>
12 </property>
13 <property name="windowTitle">
14 <string>Data sources</string>
15 </property>
16 <layout class="QGridLayout" name="gridLayout">
17 <item row="0" column="0">
18 <widget class="QTreeWidget" name="treeWidget"/>
19 </item>
20 </layout>
21 </widget>
22 <resources/>
23 <connections/>
24 </ui>
@@ -85,7 +85,7
85 85 <number>0</number>
86 86 </property>
87 87 <item>
88 <widget class="QWidget" name="dateSourceWidget" native="true"/>
88 <widget class="DataSourceWidget" name="dataSourceWidget" native="true"/>
89 89 </item>
90 90 <item>
91 91 <widget class="QWidget" name="dateTimeWidget" native="true"/>
@@ -202,6 +202,12
202 202 <header location="global">sidepane/SqpSidePane.h</header>
203 203 <container>1</container>
204 204 </customwidget>
205 <customwidget>
206 <class>DataSourceWidget</class>
207 <extends>QWidget</extends>
208 <header location="global">DataSource/DataSourceWidget.h</header>
209 <container>1</container>
210 </customwidget>
205 211 </customwidgets>
206 212 <resources/>
207 213 <connections/>
General Comments 0
You need to be logged in to leave comments. Login now