VisualizationTabWidget.h
90 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) | ||
r1423 | class Variable2; | |||
r118 | class VisualizationZoneWidget; | |||
r1420 | namespace Ui | |||
{ | ||||
r58 | class VisualizationTabWidget; | |||
} // namespace Ui | ||||
r1420 | class VisualizationTabWidget : public QWidget, public IVisualizationWidget | |||
{ | ||||
r58 | Q_OBJECT | |||
public: | ||||
r1420 | explicit VisualizationTabWidget(const QString& name = {}, QWidget* parent = 0); | |||
r58 | virtual ~VisualizationTabWidget(); | |||
r1136 | /// Adds a zone widget | |||
r1420 | void addZone(VisualizationZoneWidget* zoneWidget); | |||
r118 | ||||
r1136 | /// Inserts a zone widget at the specified position | |||
r1420 | void insertZone(int index, VisualizationZoneWidget* zoneWidget); | |||
r839 | ||||
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. | ||||
r1420 | VisualizationZoneWidget* getZoneWithName(const QString& zoneName); | |||
r1138 | ||||
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 | ||||
*/ | ||||
r1420 | VisualizationZoneWidget* createZone(std::shared_ptr<Variable2> 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 | ||||
*/ | ||||
r1420 | VisualizationZoneWidget* createZone( | |||
const std::vector<std::shared_ptr<Variable2>>& 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 | ||||
*/ | ||||
r1420 | VisualizationZoneWidget* createEmptyZone(int index); | |||
r841 | ||||
r118 | // IVisualizationWidget interface | |||
r1420 | void accept(IVisualizationWidgetVisitor* visitor) override; | |||
bool canDrop(Variable2& variable) const override; | ||||
bool contains(Variable2& variable) const override; | ||||
r119 | QString name() const override; | |||
r118 | ||||
Alexandre Leroux
|
r738 | protected: | ||
r1420 | void closeEvent(QCloseEvent* event) override; | |||
Alexandre Leroux
|
r738 | |||
r58 | private: | |||
Alexandre Leroux
|
r307 | /// @return the layout of tab in which zones are added | ||
r1420 | QLayout& tabLayout() const noexcept; | |||
Alexandre Leroux
|
r307 | |||
r1420 | Ui::VisualizationTabWidget* ui; | |||
Alexandre Leroux
|
r198 | |||
class VisualizationTabWidgetPrivate; | ||||
spimpl::unique_impl_ptr<VisualizationTabWidgetPrivate> impl; | ||||
r839 | ||||
private slots: | ||||
r1420 | void dropMimeData(int index, const QMimeData* mimeData); | |||
r58 | }; | |||
#endif // SCIQLOP_VISUALIZATIONTABWIDGET_H | ||||