QWT 7.0.1
Loading...
Searching...
No Matches
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{
40 public:
48 {
51
57
63 ItemFocusIndicator
64 };
65
66 explicit QwtPlotAbstractCanvas( QWidget* canvasWidget );
67 virtual ~QwtPlotAbstractCanvas();
68
69 QwtPlot* plot();
70 const QwtPlot* plot() const;
71
72 void setFocusIndicator( FocusIndicator );
73 FocusIndicator focusIndicator() const;
74
75 void setBorderRadius( double );
76 double borderRadius() const;
77
78 protected:
79 QWidget* canvasWidget();
80 const QWidget* canvasWidget() const;
81
82 virtual void drawFocusIndicator( QPainter* );
83 virtual void drawBorder( QPainter* );
84 virtual void drawBackground( QPainter* );
85
86 void fillBackground( QPainter* );
87 void drawCanvas( QPainter* );
88 void drawStyled( QPainter*, bool );
89 void drawUnstyled( QPainter* );
90
91 QPainterPath canvasBorderPath( const QRect& rect ) const;
92 void updateStyleSheetInfo();
93
94 private:
95 Q_DISABLE_COPY(QwtPlotAbstractCanvas)
96
97 class PrivateData;
98 PrivateData* m_data;
99};
100
105{
106 public:
115 {
127 BackingStore = 1,
128
135 ImmediatePaint = 8,
136 };
137
139 Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
140
141 explicit QwtPlotAbstractGLCanvas( QWidget* canvasWidget );
142 virtual ~QwtPlotAbstractGLCanvas();
143
144 void setPaintAttribute( PaintAttribute, bool on = true );
145 bool testPaintAttribute( PaintAttribute ) const;
146
147 void setFrameStyle( int style );
148 int frameStyle() const;
149
150 void setFrameShadow( QFrame::Shadow );
151 QFrame::Shadow frameShadow() const;
152
153 void setFrameShape( QFrame::Shape );
154 QFrame::Shape frameShape() const;
155
156 void setLineWidth( int );
157 int lineWidth() const;
158
159 void setMidLineWidth( int );
160 int midLineWidth() const;
161
162 int frameWidth() const;
163 QRect frameRect() const;
164
166 virtual void invalidateBackingStore() = 0;
167
168 protected:
169 void replot();
170 void draw( QPainter* );
171
172 private:
173 virtual void clearBackingStore() = 0;
174
175 class PrivateData;
176 PrivateData* m_data;
177};
178
179Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotAbstractGLCanvas::PaintAttributes )
180
181#endif
Base class for all type of plot canvases.
Definition qwt_plot_abstract_canvas.h:39
FocusIndicator
Focus indicator The default setting is NoFocusIndicator.
Definition qwt_plot_abstract_canvas.h:48
@ NoFocusIndicator
Don't paint a focus indicator.
Definition qwt_plot_abstract_canvas.h:50
@ CanvasFocusIndicator
The focus is related to the complete canvas.
Definition qwt_plot_abstract_canvas.h:56
Base class of QwtPlotOpenGLCanvas and QwtPlotGLCanvas.
Definition qwt_plot_abstract_canvas.h:105
virtual void invalidateBackingStore()=0
Invalidate the internal backing store.
PaintAttribute
Paint attributes.
Definition qwt_plot_abstract_canvas.h:115
A 2-D plotting widget.
Definition qwt_plot.h:99