15 #include <qpainterpath.h> 16 #include <qcoreevent.h> 17 #include <qopenglframebufferobject.h> 18 #include <qopenglpaintdevice.h> 39 QOpenGLFramebufferObject*
fbo;
50 QOpenGLWidget( plot ),
53 QSurfaceFormat fmt =
format();
60 QOpenGLWidget( plot ),
74 setAttribute( Qt::WA_OpaquePaintEvent,
true );
93 QOpenGLWidget::paintEvent( event );
103 const bool ok = QOpenGLWidget::event( event );
105 if ( event->type() == QEvent::PolishRequest )
114 if ( event->type() == QEvent::PolishRequest ||
115 event->type() == QEvent::StyleChange )
120 setAttribute( Qt::WA_StyledBackground,
121 testAttribute( Qt::WA_StyleSheet ) );
154 const bool hasFocusIndicator =
160 QOpenGLFramebufferObject::hasOpenGLFramebufferBlit() )
163 const QSize fboSize = size() * pixelRatio;
165 if ( hasFocusIndicator )
166 painter.begin(
this );
189 QOpenGLFramebufferObjectFormat fboFormat;
191 fboFormat.setAttachment( QOpenGLFramebufferObject::CombinedDepthStencil );
193 d_data->
fbo =
new QOpenGLFramebufferObject( fboSize, fboFormat );
201 QOpenGLPaintDevice pd( fboSize );
203 QPainter fboPainter( &pd );
204 fboPainter.scale( pixelRatio, pixelRatio );
211 QOpenGLFramebufferObject::blitFramebuffer( NULL,
d_data->
fbo );
215 painter.begin(
this );
219 if ( hasFocusIndicator )
229 #include "moc_qwt_plot_opengl_canvas.cpp" Q_INVOKABLE QPainterPath borderPath(const QRect &) const
Paint double buffered reusing the content of the pixmap buffer when possible.
void init(const QSurfaceFormat &)
FMT_INLINE std::basic_string< Char > format(const S &format_str, Args &&...args)
bool testPaintAttribute(PaintAttribute) const
virtual void paintGL() QWT_OVERRIDE
FocusIndicator focusIndicator() const
virtual void paintEvent(QPaintEvent *) QWT_OVERRIDE
virtual bool event(QEvent *) QWT_OVERRIDE
virtual ~QwtPlotOpenGLCanvas()
Destructor.
virtual void resizeGL(int width, int height) QWT_OVERRIDE
virtual void clearBackingStore() QWT_OVERRIDE
static qreal devicePixelRatio(const QPaintDevice *)
virtual Q_INVOKABLE void invalidateBackingStore() QWT_OVERRIDE
QPainterPath borderPath2(const QRect &rect) const
QwtPlot * plot()
Return parent plot widget.
QOpenGLFramebufferObject * fbo
virtual void initializeGL() QWT_OVERRIDE
virtual void drawFocusIndicator(QPainter *)
QwtPlotOpenGLCanvas(QwtPlot *=NULL)
Constructor.