VisualizationTabWidget.h
88 lines
| 2.9 KiB
| text/x-c
|
CLexer
r58 | #ifndef SCIQLOP_VISUALIZATIONTABWIDGET_H | |||
#define SCIQLOP_VISUALIZATIONTABWIDGET_H | ||||
r118 | #include "Visualization/IVisualizationWidget.h" | |||
Alexandre Leroux
|
r198 | #include <Common/spimpl.h> | ||
Alexandre Leroux
|
r219 | #include <QLoggingCategory> | ||
r839 | #include <QMimeData> | |||
r844 | #include <QWidget> | |||
r58 | ||||
Alexandre Leroux
|
r219 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationTabWidget) | ||
Alexandre Leroux
|
r203 | class Variable; | ||
r118 | class VisualizationZoneWidget; | |||
r58 | namespace Ui { | |||
class VisualizationTabWidget; | ||||
} // namespace Ui | ||||
r118 | class VisualizationTabWidget : public QWidget, public IVisualizationWidget { | |||
r58 | Q_OBJECT | |||
public: | ||||
Alexandre Leroux
|
r198 | explicit VisualizationTabWidget(const QString &name = {}, QWidget *parent = 0); | ||
r58 | virtual ~VisualizationTabWidget(); | |||
r1136 | /// Adds a zone widget | |||
r118 | void addZone(VisualizationZoneWidget *zoneWidget); | |||
r1136 | /// Inserts a zone widget at the specified position | |||
r839 | void insertZone(int index, VisualizationZoneWidget *zoneWidget); | |||
r1136 | /// Returns the list of zone widget names in the order they are displayed | |||
QStringList availableZoneWidgets() const; | ||||
r1138 | /// Returns the zone with the specified name. | |||
/// If multiple zone with the same name exist, the first one is returned. | ||||
VisualizationZoneWidget *getZoneWithName(const QString &zoneName); | ||||
Alexandre Leroux
|
r201 | /** | ||
* Creates a zone using a variable. The variable will be displayed in a new graph of the new | ||||
r839 | * zone. The zone is added at the end. | |||
Alexandre Leroux
|
r201 | * @param variable the variable for which to create the zone | ||
* @return the pointer to the created zone | ||||
*/ | ||||
VisualizationZoneWidget *createZone(std::shared_ptr<Variable> variable); | ||||
r118 | ||||
r839 | /** | |||
r844 | * Creates a zone using a list of variables. The variables will be displayed in a new graph of | |||
* the new zone. The zone is inserted at the specified index. | ||||
r839 | * @param variables the variables for which to create the zone | |||
* @param index The index where the zone should be inserted in the layout | ||||
* @return the pointer to the created zone | ||||
*/ | ||||
r844 | VisualizationZoneWidget *createZone(const QList<std::shared_ptr<Variable> > &variables, | |||
int index); | ||||
r839 | ||||
r841 | /** | |||
* Creates a zone which is empty (no variables). The zone is inserted at the specified index. | ||||
* @param index The index where the zone should be inserted in the layout | ||||
* @return the pointer to the created zone | ||||
*/ | ||||
VisualizationZoneWidget *createEmptyZone(int index); | ||||
r118 | // IVisualizationWidget interface | |||
Alexandre Leroux
|
r207 | void accept(IVisualizationWidgetVisitor *visitor) override; | ||
Alexandre Leroux
|
r209 | bool canDrop(const Variable &variable) const override; | ||
Alexandre Leroux
|
r327 | bool contains(const Variable &variable) const override; | ||
r119 | QString name() const override; | |||
r118 | ||||
Alexandre Leroux
|
r738 | protected: | ||
void closeEvent(QCloseEvent *event) override; | ||||
r58 | private: | |||
Alexandre Leroux
|
r307 | /// @return the layout of tab in which zones are added | ||
QLayout &tabLayout() const noexcept; | ||||
r58 | Ui::VisualizationTabWidget *ui; | |||
Alexandre Leroux
|
r198 | |||
class VisualizationTabWidgetPrivate; | ||||
spimpl::unique_impl_ptr<VisualizationTabWidgetPrivate> impl; | ||||
r839 | ||||
private slots: | ||||
void dropMimeData(int index, const QMimeData *mimeData); | ||||
r58 | }; | |||
#endif // SCIQLOP_VISUALIZATIONTABWIDGET_H | ||||