VisualizationGraphWidget.h
82 lines
| 2.6 KiB
| text/x-c
|
CLexer
r58 | #ifndef SCIQLOP_VISUALIZATIONGRAPHWIDGET_H | |||
#define SCIQLOP_VISUALIZATIONGRAPHWIDGET_H | ||||
r118 | #include "Visualization/IVisualizationWidget.h" | |||
Alexandre Leroux
|
r219 | #include <QLoggingCategory> | ||
r58 | #include <QWidget> | |||
r118 | #include <memory> | |||
#include <Common/spimpl.h> | ||||
Alexandre Leroux
|
r219 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationGraphWidget) | ||
Alexandre Leroux
|
r227 | class QCPRange; | ||
r298 | class SqpDateTime; | |||
r118 | class Variable; | |||
r444 | /** | |||
* Possible types of zoom operation | ||||
*/ | ||||
enum class VisualizationGraphWidgetZoomType { ZoomOut, ZoomIn, PanRight, PanLeft, Unknown }; | ||||
r58 | namespace Ui { | |||
class VisualizationGraphWidget; | ||||
} // namespace Ui | ||||
r118 | class VisualizationGraphWidget : public QWidget, public IVisualizationWidget { | |||
r58 | Q_OBJECT | |||
public: | ||||
Alexandre Leroux
|
r205 | explicit VisualizationGraphWidget(const QString &name = {}, QWidget *parent = 0); | ||
r58 | virtual ~VisualizationGraphWidget(); | |||
r444 | void enableSynchronize(bool enable); | |||
r118 | void addVariable(std::shared_ptr<Variable> variable); | |||
r314 | void addVariableUsingGraph(std::shared_ptr<Variable> variable); | |||
Alexandre Leroux
|
r270 | /// Removes a variable from the graph | ||
void removeVariable(std::shared_ptr<Variable> variable) noexcept; | ||||
r118 | ||||
r437 | void setRange(std::shared_ptr<Variable> variable, const SqpDateTime &range); | |||
r447 | SqpDateTime graphRange() const noexcept; | |||
r444 | void setGraphRange(const SqpDateTime &range); | |||
r437 | ||||
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; | ||
Alexandre Leroux
|
r218 | QString name() const override; | ||
r118 | ||||
r444 | ||||
r298 | signals: | |||
void requestDataLoading(std::shared_ptr<Variable> variable, const SqpDateTime &dateTime); | ||||
r444 | void synchronize(const SqpDateTime &dateTime, const SqpDateTime &oldDateTime, | |||
VisualizationGraphWidgetZoomType zoomType); | ||||
r298 | ||||
r235 | ||||
r58 | private: | |||
Ui::VisualizationGraphWidget *ui; | ||||
r118 | ||||
class VisualizationGraphWidgetPrivate; | ||||
spimpl::unique_impl_ptr<VisualizationGraphWidgetPrivate> impl; | ||||
Alexandre Leroux
|
r179 | |||
private slots: | ||||
Alexandre Leroux
|
r269 | /// Slot called when right clicking on the graph (displays a menu) | ||
void onGraphMenuRequested(const QPoint &pos) noexcept; | ||||
Alexandre Leroux
|
r227 | |||
r444 | /// Rescale the X axe to range parameter | |||
void onRangeChanged(const QCPRange &t1, const QCPRange &t2); | ||||
Alexandre Leroux
|
r227 | |||
Alexandre Leroux
|
r179 | /// Slot called when a mouse wheel was made, to perform some processing before the zoom is done | ||
void onMouseWheel(QWheelEvent *event) noexcept; | ||||
r445 | /// 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; | ||||
r235 | ||||
void onDataCacheVariableUpdated(); | ||||
r58 | }; | |||
#endif // SCIQLOP_VISUALIZATIONGRAPHWIDGET_H | ||||