🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
UiFigure.hpp
浏览该文件的文档.
1
21
22#pragma once
23
24#include "AstGlobal.h"
25#include "EditFigureDialog.hpp"
26#include <QWidget>
27#include <QMap>
28#include <QList>
29#include <QPointer>
30#include <QScopedPointer>
31
32class QwtFigure;
33class QwtPlot;
34class QwtPlotPanner;
35class QwtPlotCanvasZoomer;
36class QwtPlotSeriesDataPicker;
37class QwtPlotSeriesDataPickerGroup;
38class QToolBar;
39class QToolButton;
40class QActionGroup;
41class QMenu;
42class QwtFigureWidgetOverlay;
43
44namespace matplot
45{
46 class figure_type;
47}
48
49AST_NAMESPACE_BEGIN
50
51class AST_CHART_API UiFigure : public QWidget {
52 Q_OBJECT
53public:
55 explicit UiFigure(matplot::figure_type* pltfigure, QWidget* parent = nullptr);
56
57 ~UiFigure() override;
58
60 QwtFigure* qwtfigure() const { return qwtfigure_; }
61
63 matplot::figure_type* pltfigure() const { return pltfigure_; }
64
66 QToolBar* toolBar() const { return toolBar_; }
67
69 void setFigureSize(int w, int h);
70
72 QSize sizeHint() const override;
73
75 void refreshOriginalLimits();
76
78 void syncToolbarState();
79
81 void replotAll();
82
84 void restoreNavigationState();
85
87 void restoreEditModeIfNeeded();
88
89public slots:
91 void saveFigure();
92
94 void resetView();
95
97 void setPanMode(bool on);
98
100 void setZoomInMode(bool on);
101
103 void zoomOut();
104
106 void toggleLegend(bool on);
107
109 void toggleGrid(bool on);
110
112 void toggleColorbar(bool on);
113
115 void setEditMode(bool on);
116
118 void openPropertyInspector();
119
120private slots:
122 void onOverlayGeometryChanged(QWidget* w, QRectF oldNorm, QRectF newNorm);
124 void onPickActionToggled(bool on);
125
126private:
127 void setupUi();
128 void createActions();
129 void clearPanners();
130 void clearZoomers();
131 void clearDataPickers();
132 void createDataPickers();
133 void createOverlay();
134 void clearOverlay();
135 QIcon loadIcon(const QString& name) const;
136 QList<QwtPlot*> allAxes() const;
137
138 struct AxisLimits {
139 double xMin = 0, xMax = 0, yMin = 0, yMax = 0;
140 };
141
142 QwtFigure* qwtfigure_ = nullptr;
143 matplot::figure_type* pltfigure_ = nullptr;
144 QToolBar* toolBar_ = nullptr;
145 QAction* panAction_ = nullptr;
146 QAction* zoomInAction_ = nullptr;
147 QAction* legendAction_ = nullptr;
148 QAction* gridAction_ = nullptr;
149 QAction* colorbarAction_ = nullptr;
150 QAction* pickYAction_ = nullptr;
151 QAction* pickNearestAction_ = nullptr;
152 QMenu* dataPickMenu_ = nullptr;
153 QToolButton* dataPickBtn_ = nullptr;
154 QMap<QwtPlot*, AxisLimits> originalLimits_;
155 QList<QPointer<QwtPlotPanner>> panners_;
156 QList<QPointer<QwtPlotCanvasZoomer>> zoomers_;
157 QList<QPointer<QwtPlotSeriesDataPicker>> dataPickers_;
158 QScopedPointer<QwtPlotSeriesDataPickerGroup> dataPickerGroup_;
159
160 // 编辑模式
161 QAction* editModeAction_ = nullptr;
162 QScopedPointer<QwtFigureWidgetOverlay> overlay_;
163
164 // 属性检查器
165 QAction* propertiesAction_ = nullptr;
166 QPointer<EditFigureDialog> propertiesDialog_;
167};
168
169AST_NAMESPACE_END
Figure 元素属性编辑对话框
定义 UiFigure.hpp:51
QToolBar * toolBar() const
获取工具栏
定义 UiFigure.hpp:66
QwtFigure * qwtfigure() const
获取内部的 QwtFigure
定义 UiFigure.hpp:60
matplot::figure_type * pltfigure() const
获取内部的 matplot::figure_type
定义 UiFigure.hpp:63