VisualizationGraphWidget.h
86 lines
| 2.8 KiB
| text/x-c
|
CLexer
r58 | #ifndef SCIQLOP_VISUALIZATIONGRAPHWIDGET_H | |||
#define SCIQLOP_VISUALIZATIONGRAPHWIDGET_H | ||||
r111 | #include "Visualization/IVisualizationWidget.h" | |||
Alexandre Leroux
|
r204 | #include <QLoggingCategory> | ||
r58 | #include <QWidget> | |||
r111 | #include <memory> | |||
#include <Common/spimpl.h> | ||||
Alexandre Leroux
|
r204 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationGraphWidget) | ||
Alexandre Leroux
|
r211 | class QCPRange; | ||
r471 | class SqpRange; | |||
r111 | class Variable; | |||
r58 | namespace Ui { | |||
class VisualizationGraphWidget; | ||||
} // namespace Ui | ||||
r111 | class VisualizationGraphWidget : public QWidget, public IVisualizationWidget { | |||
r58 | Q_OBJECT | |||
public: | ||||
Alexandre Leroux
|
r191 | explicit VisualizationGraphWidget(const QString &name = {}, QWidget *parent = 0); | ||
r58 | virtual ~VisualizationGraphWidget(); | |||
r510 | /// If acquisition isn't enable, requestDataLoading signal cannot be emit | |||
void enableAcquisition(bool enable); | ||||
r410 | ||||
r518 | void addVariable(std::shared_ptr<Variable> variable, SqpRange range); | |||
Alexandre Leroux
|
r250 | /// Removes a variable from the graph | ||
void removeVariable(std::shared_ptr<Variable> variable) noexcept; | ||||
r111 | ||||
r471 | void setRange(std::shared_ptr<Variable> variable, const SqpRange &range); | |||
r518 | void setYRange(const SqpRange &range); | |||
r471 | SqpRange graphRange() const noexcept; | |||
void setGraphRange(const SqpRange &range); | ||||
r403 | ||||
r111 | // IVisualizationWidget interface | |||
Alexandre Leroux
|
r192 | void accept(IVisualizationWidgetVisitor *visitor) override; | ||
Alexandre Leroux
|
r194 | bool canDrop(const Variable &variable) const override; | ||
Alexandre Leroux
|
r301 | bool contains(const Variable &variable) const override; | ||
Alexandre Leroux
|
r203 | QString name() const override; | ||
r111 | ||||
r410 | ||||
r276 | signals: | |||
r510 | void synchronize(const SqpRange &range, const SqpRange &oldRange); | |||
void requestDataLoading(QVector<std::shared_ptr<Variable> > variable, const SqpRange &range, | ||||
const SqpRange &oldRange, bool synchronise); | ||||
r276 | ||||
r219 | ||||
r511 | void variableAdded(std::shared_ptr<Variable> var); | |||
r58 | private: | |||
Ui::VisualizationGraphWidget *ui; | ||||
r111 | ||||
class VisualizationGraphWidgetPrivate; | ||||
spimpl::unique_impl_ptr<VisualizationGraphWidgetPrivate> impl; | ||||
Alexandre Leroux
|
r166 | |||
private slots: | ||||
Alexandre Leroux
|
r249 | /// Slot called when right clicking on the graph (displays a menu) | ||
void onGraphMenuRequested(const QPoint &pos) noexcept; | ||||
Alexandre Leroux
|
r211 | |||
r410 | /// Rescale the X axe to range parameter | |||
void onRangeChanged(const QCPRange &t1, const QCPRange &t2); | ||||
Alexandre Leroux
|
r211 | |||
Alexandre Leroux
|
r443 | /// Slot called when a mouse move was made | ||
void onMouseMove(QMouseEvent *event) noexcept; | ||||
Alexandre Leroux
|
r166 | /// Slot called when a mouse wheel was made, to perform some processing before the zoom is done | ||
void onMouseWheel(QWheelEvent *event) noexcept; | ||||
r411 | /// Slot called when a mouse press was made, to activate the calibration of a graph | |||
void onMousePress(QMouseEvent *event) noexcept; | ||||
/// Slot called when a mouse release was made, to deactivate the calibration of a graph | ||||
void onMouseRelease(QMouseEvent *event) noexcept; | ||||
r219 | ||||
void onDataCacheVariableUpdated(); | ||||
r538 | ||||
void onUpdateVarDisplaying(std::shared_ptr<Variable> variable, const SqpRange &range); | ||||
r58 | }; | |||
#endif // SCIQLOP_VISUALIZATIONGRAPHWIDGET_H | ||||