Qwt User's Guide  6.1.3
qwt_plot_canvas.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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_CANVAS_H
11 #define QWT_PLOT_CANVAS_H
12 
13 #include "qwt_global.h"
14 #include <qframe.h>
15 #include <qpainterpath.h>
16 
17 class QwtPlot;
18 class QPixmap;
19 
27 class QWT_EXPORT QwtPlotCanvas : public QFrame
28 {
29  Q_OBJECT
30 
31  Q_PROPERTY( double borderRadius READ borderRadius WRITE setBorderRadius )
32 
33 public:
34 
43  {
55  BackingStore = 1,
56 
72  Opaque = 2,
73 
89  HackStyledBackground = 4,
90 
97  ImmediatePaint = 8
98  };
99 
101  typedef QFlags<PaintAttribute> PaintAttributes;
102 
110  {
113 
119 
125  ItemFocusIndicator
126  };
127 
128  explicit QwtPlotCanvas( QwtPlot * = NULL );
129  virtual ~QwtPlotCanvas();
130 
131  QwtPlot *plot();
132  const QwtPlot *plot() const;
133 
134  void setFocusIndicator( FocusIndicator );
135  FocusIndicator focusIndicator() const;
136 
137  void setBorderRadius( double );
138  double borderRadius() const;
139 
140  void setPaintAttribute( PaintAttribute, bool on = true );
141  bool testPaintAttribute( PaintAttribute ) const;
142 
143  const QPixmap *backingStore() const;
144  void invalidateBackingStore();
145 
146  virtual bool event( QEvent * );
147 
148  Q_INVOKABLE QPainterPath borderPath( const QRect & ) const;
149 
150 public Q_SLOTS:
151  void replot();
152 
153 protected:
154  virtual void paintEvent( QPaintEvent * );
155  virtual void resizeEvent( QResizeEvent * );
156 
157  virtual void drawFocusIndicator( QPainter * );
158  virtual void drawBorder( QPainter * );
159 
160  void updateStyleSheetInfo();
161 
162 private:
163  void drawCanvas( QPainter *, bool withBackground );
164 
165  class PrivateData;
166  PrivateData *d_data;
167 };
168 
169 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotCanvas::PaintAttributes )
170 
171 #endif
FocusIndicator
Focus indicator The default setting is NoFocusIndicator.
Definition: qwt_plot_canvas.h:109
PaintAttribute
Paint attributes.
Definition: qwt_plot_canvas.h:42
Definition: qwt_plot_canvas.h:118
A 2-D plotting widget.
Definition: qwt_plot.h:74
QFlags< PaintAttribute > PaintAttributes
Paint attributes.
Definition: qwt_plot_canvas.h:101
Canvas of a QwtPlot.
Definition: qwt_plot_canvas.h:27
Don&#39;t paint a focus indicator.
Definition: qwt_plot_canvas.h:112