6#include <QtGui/QOpenGLContext>
7#include <QtGui/QOffscreenSurface>
8#include <QtGui/QOpenGLFunctions>
9#include <QtGui/QWindow>
10#include <QtGui/QGuiApplication>
11#include <QtGui/QScreen>
12#include <QtGui/qpa/qplatformwindow.h>
13#include <QtGui/qpa/qplatformintegration.h>
14#include <QtOpenGL/QOpenGLFramebufferObject>
15#include <QtOpenGL/QOpenGLPaintDevice>
17#include <QtGui/private/qguiapplication_p.h>
18#include <QtGui/private/qopenglextensions_p.h>
19#include <QtGui/private/qfont_p.h>
20#include <QtGui/private/qopenglcontext_p.h>
21#include <QtOpenGL/private/qopenglframebufferobject_p.h>
22#include <QtOpenGL/private/qopenglpaintdevice_p.h>
24#include <QtWidgets/private/qwidget_p.h>
25#include <QtWidgets/private/qwidgetrepaintmanager_p.h>
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
452
453
454
455
456
459
460
461
462
463
464
467
468
469
470
471
474
475
476
477
478
481
482
483
484
485
486
487
488
489
490
491
492
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
540 Q_DECLARE_PUBLIC(QOpenGLWidget)
607 if (w->autoFillBackground()) {
608 QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
609 if (w->format().hasAlpha()) {
610 f->glClearColor(0, 0, 0, 0);
612 QColor c = w->palette().brush(w->backgroundRole()).color();
613 float alpha = c.alphaF();
614 f->glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha);
616 f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
627 QOpenGLContextPrivate::get(wd->context)->defaultFboRedirect = 0;
637 if (QOpenGLContext::currentContext() != wd->context)
640 wd->fbos[wd->currentTargetBuffer]->bind();
644 QOpenGLContextPrivate::get(wd->context)->defaultFboRedirect = wd->fbos[wd->currentTargetBuffer]->handle();
654 return { wrapperTextures[QOpenGLWidget::LeftBuffer], wrapperTextures[QOpenGLWidget::RightBuffer] };
658#define GL_SRGB 0x8C40
661#define GL_SRGB8 0x8C41
664#define GL_SRGB_ALPHA 0x8C42
666#ifndef GL_SRGB8_ALPHA8
667#define GL_SRGB8_ALPHA8 0x8C43
672 QPlatformTextureList::Flags flags = QWidgetPrivate::textureListFlags();
673 switch (textureFormat) {
678 flags |= QPlatformTextureList::TextureIsSrgb;
695 paintDevice =
nullptr;
731 emit q->aboutToResize();
733 context->makeCurrent(surface);
738 QOpenGLExtensions *extfuncs =
static_cast<QOpenGLExtensions *>(context->functions());
739 if (!extfuncs->hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample))
742 QOpenGLFramebufferObjectFormat format;
743 format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
744 format.setSamples(samples);
746 format.setInternalTextureFormat(textureFormat);
748 const QSize deviceSize = q->size() * q->devicePixelRatio();
749 fbos[QOpenGLWidget::LeftBuffer] =
new QOpenGLFramebufferObject(deviceSize, format);
751 resolvedFbos[QOpenGLWidget::LeftBuffer] =
new QOpenGLFramebufferObject(deviceSize);
756 fbos[QOpenGLWidget::RightBuffer] =
new QOpenGLFramebufferObject(deviceSize, format);
758 resolvedFbos[QOpenGLWidget::RightBuffer] =
new QOpenGLFramebufferObject(deviceSize);
761 textureFormat = fbos[QOpenGLWidget::LeftBuffer]->format().internalTextureFormat();
763 currentTargetBuffer = QOpenGLWidget::LeftBuffer;
764 fbos[currentTargetBuffer]->bind();
765 context->functions()->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
769 currentTargetBuffer = QOpenGLWidget::RightBuffer;
770 fbos[currentTargetBuffer]->bind();
771 context->functions()->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
773 currentTargetBuffer = QOpenGLWidget::LeftBuffer;
778 paintDevice->setSize(deviceSize);
779 paintDevice->setDevicePixelRatio(q->devicePixelRatio());
788 QRhi *rhi = QWidgetPrivate::rhi();
791 if (rhi && rhi->backend() == QRhi::OpenGLES2) {
792 const QSize deviceSize = q->size() * q->devicePixelRatio();
793 if (!wrapperTextures[currentTargetBuffer] || wrapperTextures[currentTargetBuffer]->pixelSize() != deviceSize) {
794 const uint textureId = resolvedFbos[currentTargetBuffer] ?
795 resolvedFbos[currentTargetBuffer]->texture()
796 : (fbos[currentTargetBuffer] ? fbos[currentTargetBuffer]->texture() : 0);
797 if (!wrapperTextures[currentTargetBuffer])
798 wrapperTextures[currentTargetBuffer] = rhi->newTexture(QRhiTexture::RGBA8, deviceSize, 1, QRhiTexture::RenderTarget);
800 wrapperTextures[currentTargetBuffer]->setPixelSize(deviceSize);
801 if (!wrapperTextures[currentTargetBuffer]->createFrom({textureId, 0 }))
802 qWarning(
"QOpenGLWidget: Failed to create wrapper texture");
813 static_cast<QOpenGLExtensions *>(context->functions())->flushShared();
816 emit q->aboutToCompose();
822 emit q->frameSwapped();
833 QWidget *tlw = q->window();
839 requestedSamples = requestedFormat.samples();
840 requestedFormat.setSamples(0);
842 QRhi *rhi = QWidgetPrivate::rhi();
846 if (rhi && rhi->backend() != QRhi::OpenGLES2) {
847 qWarning(
"The top-level window is not using OpenGL for composition, '%s' is not compatible with QOpenGLWidget",
855 QOpenGLContext *contextFromRhi = rhi ?
static_cast<
const QRhiGles2NativeHandles *>(rhi->nativeHandles())->context :
nullptr;
857 context =
new QOpenGLContext;
858 context->setFormat(requestedFormat);
860 QOpenGLContext *shareContext = contextFromRhi ? contextFromRhi : QOpenGLContext::globalShareContext();
862 context->setShareContext(shareContext);
863 context->setScreen(shareContext->screen());
865 if (Q_UNLIKELY(!context->create())) {
866 qWarning(
"QOpenGLWidget: Failed to create context");
870 surface =
new QOffscreenSurface;
871 surface->setFormat(context->format());
872 surface->setScreen(context->screen());
875 if (Q_UNLIKELY(!context->makeCurrent(surface))) {
876 qWarning(
"QOpenGLWidget: Failed to make context current");
883 if (tlw->windowHandle()) {
884 QSurfaceFormat tlwFormat = tlw->windowHandle()->format();
885 if (requestedFormat.swapInterval() != tlwFormat.swapInterval()) {
888 tlwFormat.setSwapInterval(requestedFormat.swapInterval());
889 tlw->windowHandle()->setFormat(tlwFormat);
891 if (requestedFormat.swapBehavior() != tlwFormat.swapBehavior()) {
892 tlwFormat.setSwapBehavior(requestedFormat.swapBehavior());
893 tlw->windowHandle()->setFormat(tlwFormat);
897 paintDevice =
new QOpenGLWidgetPaintDevice(q);
898 paintDevice->setSize(q->size() * q->devicePixelRatio());
899 paintDevice->setDevicePixelRatio(q->devicePixelRatio());
908 resolveSamplesForBuffer(QOpenGLWidget::LeftBuffer);
909 resolveSamplesForBuffer(QOpenGLWidget::RightBuffer);
915 if (resolvedFbos[targetBuffer]) {
916 q->makeCurrent(targetBuffer);
917 QRect rect(QPoint(0, 0), fbos[targetBuffer]->size());
918 QOpenGLFramebufferObject::blitFramebuffer(resolvedFbos[targetBuffer], rect, fbos[targetBuffer], rect);
930 setCurrentTargetBuffer(QOpenGLWidget::LeftBuffer);
932 QOpenGLContext *ctx = QOpenGLContext::currentContext();
934 qWarning(
"QOpenGLWidget: No current context, cannot render");
938 if (!fbos[QOpenGLWidget::LeftBuffer]) {
939 qWarning(
"QOpenGLWidget: No fbo, cannot render");
945 static bool warningGiven =
false;
946 if (!fbos[QOpenGLWidget::RightBuffer] && !warningGiven) {
947 qWarning(
"QOpenGLWidget: Stereo is enabled, but no right buffer. Using only left buffer");
952 if (updateBehavior == QOpenGLWidget::NoPartialUpdate && hasBeenComposed) {
955 if (stereo && fbos[QOpenGLWidget::RightBuffer]) {
956 setCurrentTargetBuffer(QOpenGLWidget::RightBuffer);
958 setCurrentTargetBuffer(QOpenGLWidget::LeftBuffer);
964 QOpenGLFunctions *f = ctx->functions();
965 f->glViewport(0, 0, q->width() * q->devicePixelRatio(), q->height() * q->devicePixelRatio());
969 f->glDepthMask(GL_TRUE);
972 QOpenGLContextPrivate::get(ctx)->defaultFboRedirect = fbos[currentTargetBuffer]->handle();
975 f->glBindBuffer(GL_ARRAY_BUFFER, 0);
976 f->glEnable(GL_BLEND);
979 if (updateBehavior == QOpenGLWidget::NoPartialUpdate)
982 if (stereo && fbos[QOpenGLWidget::RightBuffer]) {
983 setCurrentTargetBuffer(QOpenGLWidget::RightBuffer);
984 QOpenGLContextPrivate::get(ctx)->defaultFboRedirect = fbos[currentTargetBuffer]->handle();
986 if (updateBehavior == QOpenGLWidget::NoPartialUpdate)
989 QOpenGLContextPrivate::get(ctx)->defaultFboRedirect = 0;
997 QOpenGLExtensions *f =
static_cast<QOpenGLExtensions *>(QOpenGLContext::currentContext()->functions());
998 if (f->hasOpenGLExtension(QOpenGLExtensions::DiscardFramebuffer)) {
999 const GLenum attachments[] = {
1000 gl_color_attachment0,
1001 gl_depth_attachment,
1002 gl_stencil_attachment,
1006 gl_depth_stencil_attachment
1009 f->discardFramebuffer(GL_FRAMEBUFFER, GLsizei(
std::size(attachments)), attachments);
1011 f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
1017 QOpenGLExtensions *f =
static_cast<QOpenGLExtensions *>(QOpenGLContext::currentContext()->functions());
1018 if (f->hasOpenGLExtension(QOpenGLExtensions::DiscardFramebuffer)) {
1019 const GLenum attachments[] = {
1020 gl_depth_attachment,
1021 gl_stencil_attachment,
1025 gl_depth_stencil_attachment
1028 f->discardFramebuffer(GL_FRAMEBUFFER, GLsizei(
std::size(attachments)), attachments);
1034 delete fbos[QOpenGLWidget::LeftBuffer];
1035 fbos[QOpenGLWidget::LeftBuffer] =
nullptr;
1036 delete resolvedFbos[QOpenGLWidget::LeftBuffer];
1037 resolvedFbos[QOpenGLWidget::LeftBuffer] =
nullptr;
1039 delete fbos[QOpenGLWidget::RightBuffer];
1040 fbos[QOpenGLWidget::RightBuffer] =
nullptr;
1041 delete resolvedFbos[QOpenGLWidget::RightBuffer];
1042 resolvedFbos[QOpenGLWidget::RightBuffer] =
nullptr;
1049 return grabFramebuffer(QOpenGLWidget::LeftBuffer);
1062 if (targetBuffer == QOpenGLWidget::RightBuffer && !isStereoEnabled())
1063 targetBuffer = QOpenGLWidget::LeftBuffer;
1065 if (!fbos[targetBuffer])
1071 setCurrentTargetBuffer(targetBuffer);
1072 if (resolvedFbos[targetBuffer]) {
1073 resolveSamplesForBuffer(targetBuffer);
1074 resolvedFbos[targetBuffer]->bind();
1077 const bool hasAlpha = q->format().hasAlpha();
1078 QImage res = qt_gl_read_framebuffer(q->size() * q->devicePixelRatio(), hasAlpha, hasAlpha);
1079 res.setDevicePixelRatio(q->devicePixelRatio());
1084 if (resolvedFbos[targetBuffer]) {
1085 setCurrentTargetBuffer(targetBuffer);
1096 q->setAutoFillBackground(
true);
1105 return q->format().stereo();
1110 return setCurrentTargetBuffer(currentTargetBuffer == QOpenGLWidget::LeftBuffer ?
1111 QOpenGLWidget::RightBuffer :
1112 QOpenGLWidget::LeftBuffer);
1121 if (!fbos[currentTargetBuffer] || q->size() * q->devicePixelRatio() != fbos[currentTargetBuffer]->size()) {
1128
1129
1130QOpenGLWidget::QOpenGLWidget(QWidget *parent, Qt::WindowFlags f)
1131 : QWidget(*(
new QOpenGLWidgetPrivate), parent, f)
1134 if (Q_UNLIKELY(!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::RhiBasedRendering)
1135 || !QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)))
1136 qWarning(
"QOpenGLWidget is not supported on this platform.");
1138 d->setRenderToTexture();
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158QOpenGLWidget::~QOpenGLWidget()
1171
1172
1173
1174void QOpenGLWidget::setUpdateBehavior(UpdateBehavior updateBehavior)
1177 d->updateBehavior = updateBehavior;
1181
1182
1183
1184QOpenGLWidget::UpdateBehavior QOpenGLWidget::updateBehavior()
const
1186 Q_D(
const QOpenGLWidget);
1187 return d->updateBehavior;
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207void QOpenGLWidget::setFormat(
const QSurfaceFormat &format)
1210 if (Q_UNLIKELY(d->initialized)) {
1211 qWarning(
"QOpenGLWidget: Already initialized, setting the format has no effect");
1215 d->requestedFormat = format;
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234QSurfaceFormat QOpenGLWidget::format()
const
1236 Q_D(
const QOpenGLWidget);
1237 return d->initialized ? d->context->format() : d->requestedFormat;
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256void QOpenGLWidget::setTextureFormat(GLenum texFormat)
1259 if (Q_UNLIKELY(d->initialized)) {
1260 qWarning(
"QOpenGLWidget: Already initialized, setting the internal texture format has no effect");
1264 d->textureFormat = texFormat;
1268
1269
1270
1271
1272
1273
1274
1275GLenum QOpenGLWidget::textureFormat()
const
1277 Q_D(
const QOpenGLWidget);
1278 return d->textureFormat;
1282
1283
1284
1285
1286bool QOpenGLWidget::isValid()
const
1288 Q_D(
const QOpenGLWidget);
1289 return d->initialized && d->context->isValid();
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302void QOpenGLWidget::makeCurrent()
1305 if (!d->initialized)
1308 d->context->makeCurrent(d->surface);
1310 if (d->fbos[d->currentTargetBuffer])
1311 d->fbos[d->currentTargetBuffer]->bind();
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329void QOpenGLWidget::makeCurrent(TargetBuffer targetBuffer)
1332 if (!d->initialized)
1336 if (targetBuffer == TargetBuffer::RightBuffer && !format().stereo())
1339 d->setCurrentTargetBuffer(targetBuffer);
1343
1344
1345
1346
1347
1348
1349void QOpenGLWidget::doneCurrent()
1352 if (!d->initialized)
1355 d->context->doneCurrent();
1359
1360
1361
1362
1363
1364
1365
1366QOpenGLContext *QOpenGLWidget::context()
const
1368 Q_D(
const QOpenGLWidget);
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384GLuint QOpenGLWidget::defaultFramebufferObject()
const
1386 Q_D(
const QOpenGLWidget);
1387 return d->fbos[TargetBuffer::LeftBuffer] ? d->fbos[TargetBuffer::LeftBuffer]->handle() : 0;
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406GLuint QOpenGLWidget::defaultFramebufferObject(TargetBuffer targetBuffer)
const
1408 Q_D(
const QOpenGLWidget);
1409 return d->fbos[targetBuffer] ? d->fbos[targetBuffer]->handle() : 0;
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425void QOpenGLWidget::initializeGL()
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440void QOpenGLWidget::resizeGL(
int w,
int h)
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479void QOpenGLWidget::paintGL()
1483 d->context->functions()->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
1487
1488
1489
1490
1491
1492
1493
1494
1495void QOpenGLWidget::resizeEvent(QResizeEvent *e)
1499 if (e->size().isEmpty()) {
1500 d->fakeHidden =
true;
1503 d->fakeHidden =
false;
1506 if (!d->initialized)
1513 resizeGL(width(), height());
1514 d->sendPaintEvent(QRect(QPoint(0, 0), size()));
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528void QOpenGLWidget::paintEvent(QPaintEvent *e)
1534 if (d->initialized) {
1535 d->ensureRhiDependentResources();
1536 if (updatesEnabled())
1542
1543
1544
1545
1546
1547QImage QOpenGLWidget::grabFramebuffer()
1550 return d->grabFramebuffer();
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564QImage QOpenGLWidget::grabFramebuffer(TargetBuffer targetBuffer)
1567 return d->grabFramebuffer(targetBuffer);
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580QOpenGLWidget::TargetBuffer QOpenGLWidget::currentTargetBuffer()
const
1582 Q_D(
const QOpenGLWidget);
1583 return d->currentTargetBuffer;
1587
1588
1589int QOpenGLWidget::metric(QPaintDevice::PaintDeviceMetric metric)
const
1591 Q_D(
const QOpenGLWidget);
1592 if (d->inBackingStorePaint)
1593 return QWidget::metric(metric);
1595 auto window = d->windowHandle(QWidgetPrivate::WindowHandleMode::TopLevel);
1596 QScreen *screen = window ? window->screen() : QGuiApplication::primaryScreen();
1598 const float dpmx = qt_defaultDpiX() * 100. / 2.54;
1599 const float dpmy = qt_defaultDpiY() * 100. / 2.54;
1610 return width() * screen->physicalSize().width() / screen->geometry().width();
1612 return width() * 1000 / dpmx;
1615 return height() * screen->physicalSize().height() / screen->geometry().height();
1617 return height() * 1000 / dpmy;
1622 return qRound(screen->logicalDotsPerInchX());
1624 return qRound(dpmx * 0.0254);
1627 return qRound(screen->logicalDotsPerInchY());
1629 return qRound(dpmy * 0.0254);
1630 case PdmPhysicalDpiX:
1632 return qRound(screen->physicalDotsPerInchX());
1634 return qRound(dpmx * 0.0254);
1635 case PdmPhysicalDpiY:
1637 return qRound(screen->physicalDotsPerInchY());
1639 return qRound(dpmy * 0.0254);
1640 case PdmDevicePixelRatio:
1641 return QWidget::metric(metric);
1642 case PdmDevicePixelRatioScaled:
1643 return QWidget::metric(metric);
1644 case PdmDevicePixelRatioF_EncodedA:
1646 case PdmDevicePixelRatioF_EncodedB:
1647 return QWidget::metric(metric);
1649 qWarning(
"QOpenGLWidget::metric(): unknown metric %d", metric);
1655
1656
1657QPaintDevice *QOpenGLWidget::redirected(QPoint *p)
const
1659 Q_D(
const QOpenGLWidget);
1660 if (d->inBackingStorePaint)
1661 return QWidget::redirected(p);
1663 return d->paintDevice;
1667
1668
1669QPaintEngine *QOpenGLWidget::paintEngine()
const
1671 Q_D(
const QOpenGLWidget);
1675 if (d->inBackingStorePaint)
1676 return QWidget::paintEngine();
1678 if (!d->initialized)
1681 return d->paintDevice->paintEngine();
1689 if (targetBuffer == QOpenGLWidget::RightBuffer && !isStereoEnabled())
1692 currentTargetBuffer = targetBuffer;
1699
1700
1701bool QOpenGLWidget::event(QEvent *e)
1704 switch (e->type()) {
1705 case QEvent::WindowAboutToChangeInternal:
1706 d->resetRhiDependentResources();
1708 case QEvent::WindowChangeInternal:
1709 if (QCoreApplication::testAttribute(Qt::AA_ShareOpenGLContexts))
1717 if (d->initialized && !d->wrapperTextures[d->currentTargetBuffer] && window()->windowHandle()) {
1720 if (!QCoreApplication::testAttribute(Qt::AA_ShareOpenGLContexts))
1724 if (!d->initialized && !size().isEmpty()) {
1726 if (d->initialized) {
1731 d->sendPaintEvent(QRect(QPoint(0, 0), size()));
1736 case QEvent::DevicePixelRatioChange:
1737 if (d->initialized && d->paintDevice->devicePixelRatio() != devicePixelRatio())
1743 return QWidget::event(e);
1748#include "moc_qopenglwidget.cpp"
Combined button and popup list for selecting options.