Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_PLOT_CANVAS_H
00011 #define QWT_PLOT_CANVAS_H
00012
00013 #include "qwt_global.h"
00014 #include <qframe.h>
00015 #include <qpainterpath.h>
00016
00017 class QwtPlot;
00018 class QPixmap;
00019
00027 class QWT_EXPORT QwtPlotCanvas : public QFrame
00028 {
00029 Q_OBJECT
00030
00031 Q_PROPERTY( double borderRadius READ borderRadius WRITE setBorderRadius )
00032
00033 public:
00034
00042 enum PaintAttribute
00043 {
00055 BackingStore = 1,
00056
00072 Opaque = 2,
00073
00089 HackStyledBackground = 4,
00090
00097 ImmediatePaint = 8
00098 };
00099
00101 typedef QFlags<PaintAttribute> PaintAttributes;
00102
00109 enum FocusIndicator
00110 {
00112 NoFocusIndicator,
00113
00118 CanvasFocusIndicator,
00119
00125 ItemFocusIndicator
00126 };
00127
00128 explicit QwtPlotCanvas( QwtPlot * = NULL );
00129 virtual ~QwtPlotCanvas();
00130
00131 QwtPlot *plot();
00132 const QwtPlot *plot() const;
00133
00134 void setFocusIndicator( FocusIndicator );
00135 FocusIndicator focusIndicator() const;
00136
00137 void setBorderRadius( double );
00138 double borderRadius() const;
00139
00140 void setPaintAttribute( PaintAttribute, bool on = true );
00141 bool testPaintAttribute( PaintAttribute ) const;
00142
00143 const QPixmap *backingStore() const;
00144 void invalidateBackingStore();
00145
00146 virtual bool event( QEvent * );
00147
00148 Q_INVOKABLE QPainterPath borderPath( const QRect & ) const;
00149
00150 public Q_SLOTS:
00151 void replot();
00152
00153 protected:
00154 virtual void paintEvent( QPaintEvent * );
00155 virtual void resizeEvent( QResizeEvent * );
00156
00157 virtual void drawFocusIndicator( QPainter * );
00158 virtual void drawBorder( QPainter * );
00159
00160 void updateStyleSheetInfo();
00161
00162 private:
00163 void drawCanvas( QPainter *, bool withBackground );
00164
00165 class PrivateData;
00166 PrivateData *d_data;
00167 };
00168
00169 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotCanvas::PaintAttributes )
00170
00171 #endif