VisualizationZoneWidget.h
95 lines
| 3.4 KiB
| text/x-c
|
CLexer
r58 | #ifndef SCIQLOP_VISUALIZATIONZONEWIDGET_H | |||
#define SCIQLOP_VISUALIZATIONZONEWIDGET_H | ||||
r118 | #include "Visualization/IVisualizationWidget.h" | |||
r842 | #include "Visualization/VisualizationDragWidget.h" | |||
r118 | ||||
Alexandre Leroux
|
r219 | #include <QLoggingCategory> | ||
r58 | #include <QWidget> | |||
r539 | #include <memory> | |||
#include <Common/spimpl.h> | ||||
Alexandre Leroux
|
r219 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationZoneWidget) | ||
r58 | namespace Ui { | |||
class VisualizationZoneWidget; | ||||
r847 | } // namespace Ui | |||
r58 | ||||
Alexandre Leroux
|
r203 | class Variable; | ||
Alexandre Leroux
|
r197 | class VisualizationGraphWidget; | ||
r842 | class VisualizationZoneWidget : public VisualizationDragWidget, public IVisualizationWidget { | |||
r58 | Q_OBJECT | |||
public: | ||||
Alexandre Leroux
|
r197 | explicit VisualizationZoneWidget(const QString &name = {}, QWidget *parent = 0); | ||
r58 | virtual ~VisualizationZoneWidget(); | |||
r842 | /// Adds a graph widget | |||
r118 | void addGraph(VisualizationGraphWidget *graphWidget); | |||
r847 | /// Inserts a graph widget | |||
r842 | void insertGraph(int index, VisualizationGraphWidget *graphWidget); | |||
Alexandre Leroux
|
r200 | /** | ||
* Creates a graph using a variable. The variable will be displayed in the new graph. | ||||
r842 | * The graph is added at the end. | |||
Alexandre Leroux
|
r200 | * @param variable the variable for which to create the graph | ||
* @return the pointer to the created graph | ||||
*/ | ||||
VisualizationGraphWidget *createGraph(std::shared_ptr<Variable> variable); | ||||
r118 | ||||
r842 | /** | |||
* Creates a graph using a variable. The variable will be displayed in the new graph. | ||||
* The graph is inserted at the specified index. | ||||
* @param variable the variable for which to create the graph | ||||
* @param index The index where the graph should be inserted in the layout | ||||
* @return the pointer to the created graph | ||||
*/ | ||||
VisualizationGraphWidget *createGraph(std::shared_ptr<Variable> variable, int index); | ||||
/** | ||||
* Creates a graph using a list of variables. The variables will be displayed in the new graph. | ||||
* The graph is inserted at the specified index. | ||||
* @param variables List of variables to be added to the graph | ||||
* @param index The index where the graph should be inserted in the layout | ||||
* @return the pointer to the created graph | ||||
*/ | ||||
r847 | VisualizationGraphWidget *createGraph(const QList<std::shared_ptr<Variable> > variables, | |||
int index); | ||||
r842 | ||||
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 | ||||
r842 | // VisualisationDragWidget | |||
r847 | QMimeData *mimeData() const override; | |||
r842 | bool isDragAllowed() const override; | |||
r1003 | void notifyMouseMoveInGraph(const QPointF &graphPosition, const QPointF &plotPosition, | |||
VisualizationGraphWidget *graphWidget); | ||||
void notifyMouseLeaveGraph(VisualizationGraphWidget *graphWidget); | ||||
Alexandre Leroux
|
r738 | protected: | ||
void closeEvent(QCloseEvent *event) override; | ||||
r58 | private: | |||
Ui::VisualizationZoneWidget *ui; | ||||
r539 | ||||
class VisualizationZoneWidgetPrivate; | ||||
spimpl::unique_impl_ptr<VisualizationZoneWidgetPrivate> impl; | ||||
Alexandre Leroux
|
r657 | |||
private slots: | ||||
void onVariableAdded(std::shared_ptr<Variable> variable); | ||||
Alexandre Leroux
|
r737 | /// Slot called when a variable is about to be removed from a graph contained in the zone | ||
void onVariableAboutToBeRemoved(std::shared_ptr<Variable> variable); | ||||
r842 | ||||
r847 | void dropMimeData(int index, const QMimeData *mimeData); | |||
r881 | void dropMimeDataOnGraph(VisualizationDragWidget *dragWidget, const QMimeData *mimeData); | |||
r58 | }; | |||
#endif // SCIQLOP_VISUALIZATIONZONEWIDGET_H | ||||