10 #include "qwt_plot_canvas.h" 
   11 #include "qwt_painter.h" 
   15 #include <qpainterpath.h> 
   18 class QwtPlotCanvas::PrivateData
 
   45     m_data = 
new PrivateData;
 
   52     setFrameShadow( QFrame::Sunken );
 
   53     setFrameShape( QFrame::Panel );
 
   72     if ( 
bool( m_data->paintAttributes & attribute ) == on )
 
   76         m_data->paintAttributes |= attribute;
 
   78         m_data->paintAttributes &= ~attribute;
 
   86                 if ( m_data->backingStore == NULL )
 
   87                     m_data->backingStore = 
new QPixmap();
 
   91 #if QT_VERSION >= 0x050000 
   92                     *m_data->backingStore = grab( rect() );
 
   94                     *m_data->backingStore =
 
   95                         QPixmap::grabWidget( 
this, rect() );
 
  101                 delete m_data->backingStore;
 
  102                 m_data->backingStore = NULL;
 
  109                 setAttribute( Qt::WA_OpaquePaintEvent, 
true );
 
  129     return m_data->paintAttributes & attribute;
 
  135     return m_data->backingStore;
 
  141     if ( m_data->backingStore )
 
  142         *m_data->backingStore = QPixmap();
 
  153     if ( 
event->type() == QEvent::PolishRequest )
 
  161             setAttribute( Qt::WA_OpaquePaintEvent, 
true );
 
  165     if ( 
event->type() == QEvent::PolishRequest ||
 
  166         event->type() == QEvent::StyleChange )
 
  171     return QFrame::event( 
event );
 
  180     QPainter painter( 
this );
 
  181     painter.setClipRegion( 
event->region() );
 
  184         m_data->backingStore != NULL )
 
  186         QPixmap& bs = *m_data->backingStore;
 
  191             if ( testAttribute(Qt::WA_StyledBackground) )
 
  211                 if ( frameWidth() > 0 )
 
  216         painter.drawPixmap( 0, 0, *m_data->backingStore );
 
  220         if ( testAttribute(Qt::WA_StyledBackground ) )
 
  222             if ( testAttribute( Qt::WA_OpaquePaintEvent ) )
 
  233             if ( testAttribute( Qt::WA_OpaquePaintEvent ) )
 
  235                 if ( autoFillBackground() )
 
  245                     QPainterPath clipPath;
 
  246                     clipPath.addRect( rect() );
 
  247                     clipPath = clipPath.subtracted( 
borderPath( rect() ) );
 
  251                     painter.setClipPath( clipPath, Qt::IntersectClip );
 
  261             if ( frameWidth() > 0 )
 
  280         drawFrame( painter );
 
  293     QFrame::resizeEvent( 
event );
 
  306         repaint( contentsRect() );
 
  308         update( contentsRect() );
 
  326 #include "moc_qwt_plot_canvas.cpp" 
static void fillPixmap(const QWidget *, QPixmap &, const QPoint &offset=QPoint())
static qreal devicePixelRatio(const QPaintDevice *)
static QPixmap backingStore(QWidget *, const QSize &)
Base class for all type of plot canvases.
void fillBackground(QPainter *)
Helper function for the derived plot canvas.
virtual void drawBackground(QPainter *)
Helper function for the derived plot canvas.
void drawUnstyled(QPainter *)
Helper function for the derived plot canvas.
FocusIndicator focusIndicator() const
void updateStyleSheetInfo()
Update the cached information about the current style sheet.
double borderRadius() const
QPainterPath canvasBorderPath(const QRect &rect) const
virtual void drawBorder(QPainter *)
void drawCanvas(QPainter *)
Draw the plot to the canvas.
void drawStyled(QPainter *, bool)
Helper function for the derived plot canvas.
virtual void drawFocusIndicator(QPainter *)
QFlags< PaintAttribute > PaintAttributes
virtual void paintEvent(QPaintEvent *) override
virtual ~QwtPlotCanvas()
Destructor.
bool testPaintAttribute(PaintAttribute) const
PaintAttribute
Paint attributes.
@ Opaque
Try to fill the complete contents rectangle of the plot canvas.
@ HackStyledBackground
Try to improve painting of styled backgrounds.
@ BackingStore
Paint double buffered reusing the content of the pixmap buffer when possible.
void setPaintAttribute(PaintAttribute, bool on=true)
Changing the paint attributes.
virtual void resizeEvent(QResizeEvent *) override
QwtPlotCanvas(QwtPlot *=NULL)
Constructor.
virtual bool event(QEvent *) override
const QPixmap * backingStore() const
Q_INVOKABLE void invalidateBackingStore()
Invalidate the internal backing store.
virtual void drawBorder(QPainter *) override
Q_INVOKABLE QPainterPath borderPath(const QRect &) const