32#include <QScopedPointer>
37class QwtPlotCanvasZoomer;
38class QwtPlotSeriesDataPicker;
39class QwtPlotSeriesDataPickerGroup;
44class QwtFigureWidgetOverlay;
53class AST_CHART_API UiFigure :
public QWidget {
57 explicit UiFigure(matplot::figure_type* pltfigure, QWidget* parent =
nullptr);
60 UiFigure(
const UiFigure&) =
delete;
61 UiFigure& operator=(
const UiFigure&) =
delete;
64 QwtFigure* qwtfigure()
const {
return qwtfigure_; }
67 matplot::figure_type* pltfigure()
const {
return pltfigure_; }
70 QToolBar* toolBar()
const {
return toolBar_; }
73 void setFigureSize(
int w,
int h);
76 QSize sizeHint()
const override;
79 void refreshOriginalLimits();
82 void syncToolbarState();
88 void restoreNavigationState();
91 void restoreEditModeIfNeeded();
101 void setPanMode(
bool on);
104 void setZoomInMode(
bool on);
110 void toggleLegend(
bool on);
113 void toggleGrid(
bool on);
116 void toggleColorbar(
bool on);
119 void setEditMode(
bool on);
122 void openPropertyInspector();
126 void onOverlayGeometryChanged(QWidget* w, QRectF oldNorm, QRectF newNorm);
128 void onPickActionToggled(
bool on);
132 void createActions();
135 void clearDataPickers();
136 void createDataPickers();
137 void createOverlay();
139 QIcon loadIcon(
const QString& name)
const;
140 QList<QwtPlot*> allAxes()
const;
143 double xMin = 0, xMax = 0, yMin = 0, yMax = 0;
146 QwtFigure* qwtfigure_ =
nullptr;
147 matplot::figure_type* pltfigure_ =
nullptr;
148 QToolBar* toolBar_ =
nullptr;
149 QAction* panAction_ =
nullptr;
150 QAction* zoomInAction_ =
nullptr;
151 QAction* legendAction_ =
nullptr;
152 QAction* gridAction_ =
nullptr;
153 QAction* colorbarAction_ =
nullptr;
154 QAction* pickYAction_ =
nullptr;
155 QAction* pickNearestAction_ =
nullptr;
156 QMenu* dataPickMenu_ =
nullptr;
157 QToolButton* dataPickBtn_ =
nullptr;
158 QMap<QwtPlot*, AxisLimits> originalLimits_{};
159 QList<QPointer<QwtPlotPanner>> panners_{};
160 QList<QPointer<QwtPlotCanvasZoomer>> zoomers_{};
161 QList<QPointer<QwtPlotSeriesDataPicker>> dataPickers_{};
162 QScopedPointer<QwtPlotSeriesDataPickerGroup> dataPickerGroup_{};
165 QAction* editModeAction_ =
nullptr;
166 QScopedPointer<QwtFigureWidgetOverlay> overlay_{};
169 QAction* propertiesAction_ =
nullptr;
170 QPointer<EditFigureDialog> propertiesDialog_{};