From 8a7c6c676eeafd7b056bcae2a5a6c9d1505ecb10 2017-06-07 16:06:57 From: Alexandre Leroux Date: 2017-06-07 16:06:57 Subject: [PATCH] Creates the data source widget The widget contains a tree that will contains all the data sources attached to SciQlop (by the plugins) --- diff --git a/app/ui/MainWindow.ui b/app/ui/MainWindow.ui index 7aab4f3..c3d6abe 100644 --- a/app/ui/MainWindow.ui +++ b/app/ui/MainWindow.ui @@ -85,7 +85,7 @@ 0 - + @@ -202,6 +202,12 @@
sidepane/SqpSidePane.h
1 + + DataSourceWidget + QWidget +
DataSource/DataSourceWidget.h
+ 1 +
diff --git a/gui/include/DataSource/DataSourceWidget.h b/gui/include/DataSource/DataSourceWidget.h new file mode 100644 index 0000000..ea3f2fa --- /dev/null +++ b/gui/include/DataSource/DataSourceWidget.h @@ -0,0 +1,25 @@ +#ifndef SCIQLOP_DATASOURCEWIDGET_H +#define SCIQLOP_DATASOURCEWIDGET_H + +#include + +#include + +class DataSourceItem; + +/** + * @brief The DataSourceWidget handles the graphical representation (as a tree) of the data sources + * attached to SciQlop. + */ +class DataSourceWidget : public QWidget { + Q_OBJECT + +public: + explicit DataSourceWidget(QWidget *parent = 0); + +private: + class DataSourceWidgetPrivate; + spimpl::unique_impl_ptr impl; +}; + +#endif // SCIQLOP_DATASOURCEWIDGET_H diff --git a/gui/src/DataSource/DataSourceWidget.cpp b/gui/src/DataSource/DataSourceWidget.cpp new file mode 100644 index 0000000..5bba037 --- /dev/null +++ b/gui/src/DataSource/DataSourceWidget.cpp @@ -0,0 +1,36 @@ +#include + +#include + +#include +#include + +namespace { + +/// Number of columns displayed in the tree +const auto TREE_NB_COLUMNS = 1; + +/// Header labels for the tree +const auto TREE_HEADER_LABELS = QStringList{QObject::tr("Name")}; + +} // namespace + +class DataSourceWidget::DataSourceWidgetPrivate { +public: + explicit DataSourceWidgetPrivate(DataSourceWidget &widget) + : m_Ui{std::make_unique()} + { + m_Ui->setupUi(&widget); + + // Set tree properties + m_Ui->treeWidget->setColumnCount(TREE_NB_COLUMNS); + m_Ui->treeWidget->setHeaderLabels(TREE_HEADER_LABELS); + } + + std::unique_ptr m_Ui; +}; + +DataSourceWidget::DataSourceWidget(QWidget *parent) + : QWidget{parent}, impl{spimpl::make_unique_impl(*this)} +{ +} diff --git a/gui/ui/DataSource/DataSourceWidget.ui b/gui/ui/DataSource/DataSourceWidget.ui new file mode 100644 index 0000000..a7cf875 --- /dev/null +++ b/gui/ui/DataSource/DataSourceWidget.ui @@ -0,0 +1,24 @@ + + + DataSourceWidget + + + + 0 + 0 + 400 + 300 + + + + Data sources + + + + + + + + + +