DataSourceWidget.h
47 lines
| 1.2 KiB
| text/x-c
|
CLexer
Alexandre Leroux
|
r82 | #ifndef SCIQLOP_DATASOURCEWIDGET_H | ||
#define SCIQLOP_DATASOURCEWIDGET_H | ||||
#include <QWidget> | ||||
Alexandre Leroux
|
r1034 | #include <memory> | ||
Alexandre Leroux
|
r109 | namespace Ui { | ||
class DataSourceWidget; | ||||
} // Ui | ||||
Alexandre Leroux
|
r82 | 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); | ||||
r235 | virtual ~DataSourceWidget() noexcept; | |||
Alexandre Leroux
|
r82 | |||
Alexandre Leroux
|
r83 | public slots: | ||
/** | ||||
* Adds a data source. An item associated to the data source is created and then added to the | ||||
* representation tree | ||||
Alexandre Leroux
|
r92 | * @param dataSource the data source to add. The pointer has to be not null | ||
Alexandre Leroux
|
r83 | */ | ||
Alexandre Leroux
|
r92 | void addDataSource(DataSourceItem *dataSource) noexcept; | ||
Alexandre Leroux
|
r83 | |||
Alexandre Leroux
|
r82 | private: | ||
Alexandre Leroux
|
r1034 | void updateTreeWidget() noexcept; | ||
Alexandre Leroux
|
r109 | Ui::DataSourceWidget *ui; | ||
Alexandre Leroux
|
r1034 | std::unique_ptr<DataSourceItem> m_Root; | ||
Alexandre Leroux
|
r143 | |||
private slots: | ||||
Alexandre Leroux
|
r475 | /// Slot called when the filtering text has changed | ||
void filterChanged(const QString &text) noexcept; | ||||
Alexandre Leroux
|
r143 | /// Slot called when right clicking on an item in the tree (displays a menu) | ||
void onTreeMenuRequested(const QPoint &pos) noexcept; | ||||
Alexandre Leroux
|
r82 | }; | ||
#endif // SCIQLOP_DATASOURCEWIDGET_H | ||||