QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_plot_abstract_canvas.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_ABSTRACT_CANVAS_H
28#define QWT_PLOT_ABSTRACT_CANVAS_H
29
30#include "qwt_global.h"
31#include <qframe.h>
32
33class QwtPlot;
34
38class QWT_EXPORT QwtPlotAbstractCanvas
39{
40public:
48 {
53
59
65 ItemFocusIndicator
66 };
67
68 // Constructor
69 explicit QwtPlotAbstractCanvas(QWidget* canvasWidget);
70 // Destructor
72
73 // Get the parent plot widget
74 QwtPlot* plot();
75 // Get the parent plot widget
76 const QwtPlot* plot() const;
77
78 // Set the focus indicator
79 void setFocusIndicator(FocusIndicator);
80 // Get the focus indicator
81 FocusIndicator focusIndicator() const;
82
83 // Set the border radius
84 void setBorderRadius(double);
85 // Get the border radius
86 double borderRadius() const;
87
88protected:
89 QWidget* canvasWidget();
90 const QWidget* canvasWidget() const;
91
92 virtual void drawFocusIndicator(QPainter*);
93 virtual void drawBorder(QPainter*);
94 virtual void drawBackground(QPainter*);
95
96 void fillBackground(QPainter*);
97 void drawCanvas(QPainter*);
98 void drawStyled(QPainter*, bool);
99 void drawUnstyled(QPainter*);
100
101 QPainterPath canvasBorderPath(const QRect& rect) const;
102 void updateStyleSheetInfo();
103
104private:
106 QwtPlotAbstractCanvas& operator=(const QwtPlotAbstractCanvas&) = delete;
107
108 QWT_DECLARE_PRIVATE(QwtPlotAbstractCanvas)
109};
110
115{
116public:
123 {
132 BackingStore = 1,
133
138 ImmediatePaint = 8,
139 };
140
142 Q_DECLARE_FLAGS(PaintAttributes, PaintAttribute)
143
144 // Constructor
145 explicit QwtPlotAbstractGLCanvas(QWidget* canvasWidget);
146 // Destructor
148
149 // Set a paint attribute
150 void setPaintAttribute(PaintAttribute, bool on = true);
151 // Test a paint attribute
152 bool testPaintAttribute(PaintAttribute) const;
153
154 // Set the frame style
155 void setFrameStyle(int style);
156 // Get the frame style
157 int frameStyle() const;
158
159 // Set the frame shadow
160 void setFrameShadow(QFrame::Shadow);
161 // Get the frame shadow
162 QFrame::Shadow frameShadow() const;
163
164 // Set the frame shape
165 void setFrameShape(QFrame::Shape);
166 // Get the frame shape
167 QFrame::Shape frameShape() const;
168
169 // Set the line width
170 void setLineWidth(int);
171 // Get the line width
172 int lineWidth() const;
173
174 // Set the mid line width
175 void setMidLineWidth(int);
176 // Get the mid line width
177 int midLineWidth() const;
178
179 // Get the frame width
180 int frameWidth() const;
181 // Get the frame rect
182 QRect frameRect() const;
183
185 virtual void invalidateBackingStore() = 0;
186
187protected:
188 void replot();
189 void draw(QPainter*);
190
191private:
192 virtual void clearBackingStore() = 0;
193
194 QWT_DECLARE_PRIVATE(QwtPlotAbstractGLCanvas)
195};
196
197Q_DECLARE_OPERATORS_FOR_FLAGS(QwtPlotAbstractGLCanvas::PaintAttributes)
198
199#endif
Base class for all type of plot canvases
Definition qwt_plot_abstract_canvas.h:39
FocusIndicator
Focus indicator
Definition qwt_plot_abstract_canvas.h:48
@ NoFocusIndicator
Definition qwt_plot_abstract_canvas.h:52
@ CanvasFocusIndicator
Definition qwt_plot_abstract_canvas.h:58
Base class of QwtPlotOpenGLCanvas and QwtPlotGLCanvas
Definition qwt_plot_abstract_canvas.h:115
virtual void invalidateBackingStore()=0
Invalidate the internal backing store
PaintAttribute
Paint attributes
Definition qwt_plot_abstract_canvas.h:123
A 2-D plotting widget
Definition qwt_plot.h:99