15 #include <qpainterpath.h>
16 #include <qcoreevent.h>
17 #include <qopenglframebufferobject.h>
18 #include <qopenglpaintdevice.h>
40 QOpenGLFramebufferObject*
fbo;
50 : QOpenGLWidget( plot )
64 : QOpenGLWidget( plot )
67 if ( numSamples < -1 )
70 QSurfaceFormat fmt =
format();
71 if ( numSamples != fmt.samples() )
73 fmt.setSamples( numSamples );
85 setAttribute( Qt::WA_OpaquePaintEvent,
true );
108 QOpenGLWidget::paintEvent(
event );
118 if (
event->type() == QEvent::Resize )
131 const bool ok = QOpenGLWidget::event(
event );
133 if (
event->type() == QEvent::PolishRequest )
142 if (
event->type() == QEvent::PolishRequest ||
143 event->type() == QEvent::StyleChange )
148 setAttribute( Qt::WA_StyledBackground,
149 testAttribute( Qt::WA_StyleSheet ) );
198 const bool hasFocusIndicator =
204 QOpenGLFramebufferObject::hasOpenGLFramebufferBlit() )
207 const QSize fboSize =
size() * pixelRatio;
209 if ( hasFocusIndicator )
210 painter.begin(
this );
233 QOpenGLFramebufferObjectFormat fboFormat;
234 fboFormat.setAttachment( QOpenGLFramebufferObject::CombinedDepthStencil );
239 m_data->
fbo =
new QOpenGLFramebufferObject( fboSize, fboFormat );
247 QOpenGLPaintDevice pd( fboSize );
249 QPainter fboPainter( &pd );
250 fboPainter.scale( pixelRatio, pixelRatio );
257 QOpenGLFramebufferObject::blitFramebuffer( NULL,
m_data->
fbo );
261 painter.begin(
this );
265 if ( hasFocusIndicator )
276 #include "moc_qwt_plot_opengl_canvas.cpp"