Qwt User's Guide 6.3.0

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
10#ifndef QWT_PLOT_ABSTRACT_CANVAS_H
11#define QWT_PLOT_ABSTRACT_CANVAS_H
12
13#include "qwt_global.h"
14#include <qframe.h>
15
16 class QwtPlot;
17
21 class QWT_EXPORT QwtPlotAbstractCanvas
22{
23 public:
30 enum FocusIndicator
31 {
33 NoFocusIndicator,
34
39 CanvasFocusIndicator,
40
46 ItemFocusIndicator
47 };
48
49 explicit QwtPlotAbstractCanvas( QWidget* canvasWidget );
50 virtual ~QwtPlotAbstractCanvas();
51
52 QwtPlot* plot();
53 const QwtPlot* plot() const;
54
55 void setFocusIndicator( FocusIndicator );
56 FocusIndicator focusIndicator() const;
57
58 void setBorderRadius( double );
59 double borderRadius() const;
60
61 protected:
62 QWidget* canvasWidget();
63 const QWidget* canvasWidget() const;
64
65 virtual void drawFocusIndicator( QPainter* );
66 virtual void drawBorder( QPainter* );
67 virtual void drawBackground( QPainter* );
68
69 void fillBackground( QPainter* );
70 void drawCanvas( QPainter* );
71 void drawStyled( QPainter*, bool );
72 void drawUnstyled( QPainter* );
73
74 QPainterPath canvasBorderPath( const QRect& rect ) const;
75 void updateStyleSheetInfo();
76
77 private:
78 Q_DISABLE_COPY(QwtPlotAbstractCanvas)
79
80 class PrivateData;
81 PrivateData* m_data;
82};
83
87 class QWT_EXPORT QwtPlotAbstractGLCanvas : public QwtPlotAbstractCanvas
88{
89 public:
97 enum PaintAttribute
98 {
110 BackingStore = 1,
111
118 ImmediatePaint = 8,
119 };
120
122 Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
123
124 explicit QwtPlotAbstractGLCanvas( QWidget* canvasWidget );
125 virtual ~QwtPlotAbstractGLCanvas();
126
127 void setPaintAttribute( PaintAttribute, bool on = true );
128 bool testPaintAttribute( PaintAttribute ) const;
129
130 void setFrameStyle( int style );
131 int frameStyle() const;
132
133 void setFrameShadow( QFrame::Shadow );
134 QFrame::Shadow frameShadow() const;
135
136 void setFrameShape( QFrame::Shape );
137 QFrame::Shape frameShape() const;
138
139 void setLineWidth( int );
140 int lineWidth() const;
141
142 void setMidLineWidth( int );
143 int midLineWidth() const;
144
145 int frameWidth() const;
146 QRect frameRect() const;
147
149 virtual void invalidateBackingStore() = 0;
150
151 protected:
152 void replot();
153 void draw( QPainter* );
154
155 private:
156 virtual void clearBackingStore() = 0;
157
158 class PrivateData;
159 PrivateData* m_data;
160};
161
162Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotAbstractGLCanvas::PaintAttributes )
163
164#endif
QwtPlotAbstractCanvas
Base class for all type of plot canvases.
Definition qwt_plot_abstract_canvas.h:22
QwtPlotAbstractCanvas::FocusIndicator
FocusIndicator
Focus indicator The default setting is NoFocusIndicator.
Definition qwt_plot_abstract_canvas.h:31
QwtPlotAbstractCanvas::NoFocusIndicator
@ NoFocusIndicator
Don't paint a focus indicator.
Definition qwt_plot_abstract_canvas.h:33
QwtPlotAbstractCanvas::CanvasFocusIndicator
@ CanvasFocusIndicator
Definition qwt_plot_abstract_canvas.h:39
QwtPlotAbstractGLCanvas
Base class of QwtPlotOpenGLCanvas and QwtPlotGLCanvas.
Definition qwt_plot_abstract_canvas.h:88
QwtPlotAbstractGLCanvas::invalidateBackingStore
virtual void invalidateBackingStore()=0
Invalidate the internal backing store.
QwtPlotAbstractGLCanvas::PaintAttribute
PaintAttribute
Paint attributes.
Definition qwt_plot_abstract_canvas.h:98
QwtPlotAbstractGLCanvas::PaintAttributes
QFlags< PaintAttribute > PaintAttributes
Paint attributes.
Definition qwt_plot_abstract_canvas.h:122
QwtPlot
A 2-D plotting widget.
Definition qwt_plot.h:79