QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_polar_plot.h
1/******************************************************************************
2 * QwtPolar Widget Library
3 * Copyright (C) 2008 Uwe Rathmann
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the Qwt License, Version 1.0
7 *****************************************************************************/
8
9#ifndef QWT_POLAR_PLOT_H
10#define QWT_POLAR_PLOT_H
11
12#include "qwt_global.h"
13#include "qwt_polar.h"
14#include "qwt_polar_itemdict.h"
15#include "qwt_interval.h"
16#include "qwt_scale_map.h"
17#include "qwt_point_polar.h"
18#include <qframe.h>
19
21class QwtScaleEngine;
22class QwtScaleDiv;
23class QwtTextLabel;
24class QwtPolarCanvas;
25class QwtPolarLayout;
27
45class QWT_EXPORT QwtPolarPlot : public QFrame, public QwtPolarItemDict
46{
47 Q_OBJECT
48
49 Q_PROPERTY(QBrush plotBackground READ plotBackground WRITE setPlotBackground)
50 Q_PROPERTY(double azimuthOrigin READ azimuthOrigin WRITE setAzimuthOrigin)
51
52public:
58 {
61
64
67
70
79 ExternalLegend
80 };
81
83 explicit QwtPolarPlot(QWidget* parent = nullptr);
85 QwtPolarPlot(const QwtText& title, QWidget* parent = nullptr);
86
88 ~QwtPolarPlot() override;
89
91 void setTitle(const QString&);
93 void setTitle(const QwtText&);
94
96 QwtText title() const;
97
99 QwtTextLabel* titleLabel();
101 const QwtTextLabel* titleLabel() const;
102
104 void setAutoReplot(bool tf = true);
106 bool autoReplot() const;
107
109 void setAutoScale(int scaleId);
111 bool hasAutoScale(int scaleId) const;
112
114 void setScaleMaxMinor(int scaleId, int maxMinor);
116 int scaleMaxMinor(int scaleId) const;
117
119 int scaleMaxMajor(int scaleId) const;
121 void setScaleMaxMajor(int scaleId, int maxMajor);
122
124 QwtScaleEngine* scaleEngine(int scaleId);
126 const QwtScaleEngine* scaleEngine(int scaleId) const;
128 void setScaleEngine(int scaleId, QwtScaleEngine*);
129
131 void setScale(int scaleId, double min, double max, double step = 0);
132
134 void setScaleDiv(int scaleId, const QwtScaleDiv&);
136 const QwtScaleDiv* scaleDiv(int scaleId) const;
138 QwtScaleDiv* scaleDiv(int scaleId);
139
141 QwtScaleMap scaleMap(int scaleId, double radius) const;
143 QwtScaleMap scaleMap(int scaleId) const;
144
146 void updateScale(int scaleId);
147
149 double azimuthOrigin() const;
150
152 void zoom(const QwtPointPolar&, double factor);
154 void unzoom();
155
157 QwtPointPolar zoomPos() const;
159 double zoomFactor() const;
160
161 // Canvas
162
164 QwtPolarCanvas* canvas();
166 const QwtPolarCanvas* canvas() const;
167
169 void setPlotBackground(const QBrush& c);
171 const QBrush& plotBackground() const;
172
174 void setBackgroundColor(const QColor& c);
176 QColor backgroundColor() const;
177
179 virtual void drawCanvas(QPainter*, const QRectF&) const;
180
181 // Legend
182
184 void insertLegend(QwtAbstractLegend*, LegendPosition = RightLegend, double ratio = -1.0);
185
187 QwtAbstractLegend* legend();
189 const QwtAbstractLegend* legend() const;
190
192 void updateLegend();
194 void updateLegend(const QwtPolarItem*);
195
196 // Layout
198 QwtPolarLayout* plotLayout();
200 const QwtPolarLayout* plotLayout() const;
201
203 QwtInterval visibleInterval() const;
205 QRectF plotRect() const;
207 QRectF plotRect(const QRectF&) const;
208
210 int plotMarginHint() const;
211
213 virtual QVariant itemToInfo(QwtPolarItem*) const;
215 virtual QwtPolarItem* infoToItem(const QVariant&) const;
216
217Q_SIGNALS:
223 void itemAttached(QwtPolarItem* plotItem, bool on);
224
231 void legendDataChanged(const QVariant& itemInfo, const QList< QwtLegendData >& data);
232
237
238public Q_SLOTS:
240 virtual void replot();
242 void autoRefresh();
244 void setAzimuthOrigin(double);
245
246protected:
248 virtual bool event(QEvent*) override;
250 virtual void resizeEvent(QResizeEvent*) override;
251
253 virtual void updateLayout();
254
256 virtual void drawItems(QPainter* painter,
257 const QwtScaleMap& radialMap,
258 const QwtScaleMap& azimuthMap,
259 const QPointF& pole,
260 double radius,
261 const QRectF& canvasRect) const;
262
263private:
264 friend class QwtPolarItem;
265 void attachItem(QwtPolarItem*, bool);
266
267 void initPlot(const QwtText&);
268
269 QWT_DECLARE_PRIVATE(QwtPolarPlot)
270};
271
272#endif
Definition qwt_raster_data.h:38
Abstract base class for legend widgets
Definition qwt_abstract_legend.h:47
A class representing an interval
Definition qwt_interval.h:39
A point in polar coordinates
Definition qwt_point_polar.h:45
Canvas of a QwtPolarPlot
Definition qwt_polar_canvas.h:26
A dictionary for polar plot items
Definition qwt_polar_itemdict.h:28
Base class for items on a polar plot
Definition qwt_polar_item.h:35
Layout class for QwtPolarPlot
Definition qwt_polar_layout.h:23
A plotting widget, displaying a polar coordinate system
Definition qwt_polar_plot.h:46
void layoutChanged()
A signal that is emitted, whenever the layout of the plot has been recalculated
void itemAttached(QwtPolarItem *plotItem, bool on)
A signal indicating, that an item has been attached/detached
void legendDataChanged(const QVariant &itemInfo, const QList< QwtLegendData > &data)
A signal with the attributes how to update the legend entries for a plot item
LegendPosition
Position of the legend, relative to the canvas
Definition qwt_polar_plot.h:58
@ BottomLegend
The legend will be below the canvas
Definition qwt_polar_plot.h:66
@ LeftLegend
The legend will be left from the canvas
Definition qwt_polar_plot.h:60
@ TopLegend
The legend will be between canvas and title
Definition qwt_polar_plot.h:69
@ RightLegend
The legend will be right from the canvas
Definition qwt_polar_plot.h:63
A class for drawing round scales
Definition qwt_round_scale_draw.h:47
A class representing a scale division
Definition qwt_scale_div.h:47
Base class for scale engines
Definition qwt_scale_engine.h:62
A scale map
Definition qwt_scale_map.h:44
A Widget which displays a QwtText
Definition qwt_text_label.h:47
A class representing a text
Definition qwt_text.h:70