17 #if QT_VERSION < 0x050000 24 #include <qopenglcontext.h> 25 #include <qopenglframebufferobject.h> 26 #include <qopenglpaintdevice.h> 28 #if QT_VERSION >= 0x050100 29 #include <qoffscreensurface.h> 42 #include <qglframebufferobject.h> 46 #endif // !QWT_NO_OPENGL 50 #include <qstyleoption.h> 51 #include <qpaintengine.h> 136 #if QT_VERSION >= 0x050000 140 QPixmap::grabWidget(
this, rect() );
154 setAttribute( Qt::WA_OpaquePaintEvent,
true );
198 if ( event->type() == QEvent::PolishRequest )
206 setAttribute( Qt::WA_OpaquePaintEvent,
true );
210 if ( event->type() == QEvent::PolishRequest ||
211 event->type() == QEvent::StyleChange )
216 return QFrame::event( event );
225 QPainter painter(
this );
226 painter.setClipRegion( event->region() );
232 if ( bs.size() !=
size() )
236 #ifndef QWT_NO_OPENGL 245 if ( testAttribute(Qt::WA_StyledBackground) )
265 if ( frameWidth() > 0 )
274 #ifndef QWT_NO_OPENGL 281 if ( testAttribute(Qt::WA_StyledBackground ) )
283 if ( testAttribute( Qt::WA_OpaquePaintEvent ) )
294 if ( testAttribute( Qt::WA_OpaquePaintEvent ) )
296 if ( autoFillBackground() )
306 QPainterPath clipPath;
307 clipPath.addRect( rect() );
308 clipPath = clipPath.subtracted(
borderPath( rect() ) );
312 painter.setClipPath( clipPath, Qt::IntersectClip );
322 if ( frameWidth() > 0 )
339 #if QT_VERSION >= 0x040500 342 drawFrame( painter );
356 QFrame::resizeEvent( event );
369 repaint( contentsRect() );
388 #ifndef QWT_NO_OPENGL 390 #define FIX_GL_TRANSLATION 0 394 const int numSamples = 4;
404 QOpenGLContext context;
410 QOpenGLFramebufferObjectFormat fboFormat;
411 fboFormat.setSamples(numSamples);
412 QOpenGLFramebufferObject fbo( size, fboFormat );
414 QOpenGLPaintDevice pd( size );
420 QGLFormat
format = QGLFormat::defaultFormat();
421 format.setSampleBuffers(
true );
422 format.setSamples( numSamples );
429 #if QT_VERSION >= 0x040600 430 QGLFramebufferObjectFormat fboFormat;
431 fboFormat.setSamples(numSamples);
433 QGLFramebufferObject fbo( size, fboFormat );
435 QGLFramebufferObject fbo( size );
437 QGLFramebufferObject &pd = fbo;
441 QPainter painter( &pd );
443 if ( testAttribute( Qt::WA_StyledBackground ) )
448 if ( frameWidth() > 0 )
453 QImage image = fbo.toImage();
455 #if QT_VERSION >= 0x050000
Try to fill the complete contents rectangle of the plot canvas.
virtual void drawBackground(QPainter *)
static void fillPixmap(const QWidget *, QPixmap &, const QPoint &offset=QPoint())
QFlags< PaintAttribute > PaintAttributes
Paint attributes.
QGLWidget QwtPlotCanvasSurfaceGL
virtual void paintEvent(QPaintEvent *)
QwtPlotCanvas(QwtPlot *=NULL)
Constructor.
void drawCanvas(QPainter *)
double borderRadius() const
void drawUnstyled(QPainter *)
virtual ~QwtPlotCanvas()
Destructor.
FocusIndicator focusIndicator() const
bool testPaintAttribute(PaintAttribute) const
void drawStyled(QPainter *, bool)
Q_INVOKABLE QPainterPath borderPath(const QRect &) const
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
QwtPlotCanvas::PaintAttributes paintAttributes
const QPixmap * backingStore() const
Render the canvas via an OpenGL buffer.
static qreal devicePixelRatio(const QPaintDevice *)
QImage toImageFBO(const QSize &size)
std::string format(const std::string &, const time_point< seconds > &, const femtoseconds &, const time_zone &)
PaintAttribute
Paint attributes.
void setPaintAttribute(PaintAttribute, bool on=true)
Changing the paint attributes.
QPainterPath borderPath2(const QRect &rect) const
QwtPlotCanvasSurfaceGL * surfaceGL
virtual void drawBorder(QPainter *)
virtual void resizeEvent(QResizeEvent *)
virtual void drawBorder(QPainter *)
Q_INVOKABLE void invalidateBackingStore()
Invalidate the internal backing store.
virtual void drawFocusIndicator(QPainter *)
void fillBackground(QPainter *)
void updateStyleSheetInfo()
Update the cached information about the current style sheet.
virtual bool event(QEvent *)
static QPixmap backingStore(QWidget *, const QSize &)
Try to improve painting of styled backgrounds.
Paint double buffered reusing the content of the pixmap buffer when possible.