QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_plot_shapeitem.h
1/******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *
9 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_PLOT_SHAPE_ITEM_H
28#define QWT_PLOT_SHAPE_ITEM_H
29
30#include "qwt_global.h"
31#include "qwt_plot_item.h"
32
33#include <qstring.h>
34
35class QPainterPath;
36class QPolygonF;
37
54class QWT_EXPORT QwtPlotShapeItem : public QwtPlotItem
55{
56public:
65 {
76 ClipPolygons = 0x01,
77 };
78
79 Q_DECLARE_FLAGS(PaintAttributes, PaintAttribute)
80
81
87 {
90
92 LegendColor
93 };
94
95 // Constructor
96 explicit QwtPlotShapeItem(const QString& title = QString());
97 // Constructor with title
98 explicit QwtPlotShapeItem(const QwtText& title);
99
100 // Destructor
101 ~QwtPlotShapeItem() override;
102
103 // Set a paint attribute
104 void setPaintAttribute(PaintAttribute, bool on = true);
105 // Test a paint attribute
106 bool testPaintAttribute(PaintAttribute) const;
107
108 // Set the legend mode
109 void setLegendMode(LegendMode);
110 // Get the legend mode
111 LegendMode legendMode() const;
112
113 // Set the shape as a rectangle
114 void setRect(const QRectF&);
115 // Set the shape as a polygon
116 void setPolygon(const QPolygonF&);
117
118 // Set the shape
119 void setShape(const QPainterPath&);
120 // Get the shape
121 QPainterPath shape() const;
122
123 // Set the pen
124 void setPen(const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine);
125 // Set the pen
126 void setPen(const QPen&);
127 // Get the pen
128 QPen pen() const;
129
130 // Set the brush
131 void setBrush(const QBrush&);
132 // Get the brush
133 QBrush brush() const;
134
135 // Set the render tolerance
136 void setRenderTolerance(double);
137 // Get the render tolerance
138 double renderTolerance() const;
139
140 // Get the bounding rectangle
141 virtual QRectF boundingRect() const override;
142
143 // Draw the shape item
144 virtual void draw(QPainter*, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect) const override;
145
146 // Get the legend icon
147 virtual QwtGraphic legendIcon(int index, const QSizeF&) const override;
148
149 // Get the runtime type information
150 virtual int rtti() const override;
151
152private:
156 void init();
157
158 QWT_DECLARE_PRIVATE(QwtPlotShapeItem)
159};
160
161#endif
A paint device for scalable graphics
Definition qwt_graphic.h:85
Base class for items on the plot canvas
Definition qwt_plot_item.h:85
virtual void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const =0
Draw the item
virtual QwtGraphic legendIcon(int index, const QSizeF &) const
Return a legend icon
Definition qwt_plot_item.cpp:420
virtual int rtti() const
Runtime type information
Definition qwt_plot_item.cpp:155
virtual QRectF boundingRect() const
Get the bounding rectangle
Definition qwt_plot_item.cpp:593
A plot item, which displays any graphical shape that can be defined by a QPainterPath
Definition qwt_plot_shapeitem.h:55
LegendMode
Legend modes
Definition qwt_plot_shapeitem.h:87
@ LegendShape
Display a scaled down version of the shape
Definition qwt_plot_shapeitem.h:89
PaintAttribute
Paint attributes
Definition qwt_plot_shapeitem.h:65
A scale map
Definition qwt_scale_map.h:44
A class representing a text
Definition qwt_text.h:70