5#include <QtGui/QOpenGLContext>
6#include <QtGui/QOffscreenSurface>
7#include <QtGui/QOpenGLFunctions>
8#include <QtGui/QWindow>
9#include <QtGui/QGuiApplication>
10#include <QtGui/QScreen>
11#include <QtGui/qpa/qplatformwindow.h>
12#include <QtGui/qpa/qplatformintegration.h>
13#include <QtOpenGL/QOpenGLFramebufferObject>
14#include <QtOpenGL/QOpenGLPaintDevice>
16#include <QtGui/private/qguiapplication_p.h>
17#include <QtGui/private/qopenglextensions_p.h>
18#include <QtGui/private/qfont_p.h>
19#include <QtGui/private/qopenglcontext_p.h>
20#include <QtOpenGL/private/qopenglframebufferobject_p.h>
21#include <QtOpenGL/private/qopenglpaintdevice_p.h>
23#include <QtWidgets/private/qwidget_p.h>
24#include <QtWidgets/private/qwidgetrepaintmanager_p.h>
31
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
451
452
453
454
455
458
459
460
461
462
463
466
467
468
469
470
473
474
475
476
477
480
481
482
483
484
485
486
487
488
489
490
491
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
539 Q_DECLARE_PUBLIC(QOpenGLWidget)
606 if (w->autoFillBackground()) {
607 QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
608 if (w->format().hasAlpha()) {
609 f->glClearColor(0, 0, 0, 0);
611 QColor c = w->palette().brush(w->backgroundRole()).color();
612 float alpha = c.alphaF();
613 f->glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha);
615 f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
626 QOpenGLContextPrivate::get(wd->context)->defaultFboRedirect = 0;
636 if (QOpenGLContext::currentContext() != wd->context)
639 wd->fbos[wd->currentTargetBuffer]->bind();
643 QOpenGLContextPrivate::get(wd->context)->defaultFboRedirect = wd->fbos[wd->currentTargetBuffer]->handle();
653 return { wrapperTextures[QOpenGLWidget::LeftBuffer], wrapperTextures[QOpenGLWidget::RightBuffer] };
657#define GL_SRGB 0x8C40
660#define GL_SRGB8 0x8C41
663#define GL_SRGB_ALPHA 0x8C42
665#ifndef GL_SRGB8_ALPHA8
666#define GL_SRGB8_ALPHA8 0x8C43
671 QPlatformTextureList::Flags flags = QWidgetPrivate::textureListFlags();
672 switch (textureFormat) {
677 flags |= QPlatformTextureList::TextureIsSrgb;
694 paintDevice =
nullptr;
730 emit q->aboutToResize();
732 context->makeCurrent(surface);
737 QOpenGLExtensions *extfuncs =
static_cast<QOpenGLExtensions *>(context->functions());
738 if (!extfuncs->hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample))
741 QOpenGLFramebufferObjectFormat format;
742 format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
743 format.setSamples(samples);
745 format.setInternalTextureFormat(textureFormat);
747 const QSize deviceSize = q->size() * q->devicePixelRatio();
748 fbos[QOpenGLWidget::LeftBuffer] =
new QOpenGLFramebufferObject(deviceSize, format);
750 resolvedFbos[QOpenGLWidget::LeftBuffer] =
new QOpenGLFramebufferObject(deviceSize);
755 fbos[QOpenGLWidget::RightBuffer] =
new QOpenGLFramebufferObject(deviceSize, format);
757 resolvedFbos[QOpenGLWidget::RightBuffer] =
new QOpenGLFramebufferObject(deviceSize);
760 textureFormat = fbos[QOpenGLWidget::LeftBuffer]->format().internalTextureFormat();
762 currentTargetBuffer = QOpenGLWidget::LeftBuffer;
763 fbos[currentTargetBuffer]->bind();
764 context->functions()->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
768 currentTargetBuffer = QOpenGLWidget::RightBuffer;
769 fbos[currentTargetBuffer]->bind();
770 context->functions()->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
772 currentTargetBuffer = QOpenGLWidget::LeftBuffer;
777 paintDevice->setSize(deviceSize);
778 paintDevice->setDevicePixelRatio(q->devicePixelRatio());
787 QRhi *rhi = QWidgetPrivate::rhi();
790 if (rhi && rhi->backend() == QRhi::OpenGLES2) {
791 const QSize deviceSize = q->size() * q->devicePixelRatio();
792 if (!wrapperTextures[currentTargetBuffer] || wrapperTextures[currentTargetBuffer]->pixelSize() != deviceSize) {
793 const uint textureId = resolvedFbos[currentTargetBuffer] ?
794 resolvedFbos[currentTargetBuffer]->texture()
795 : (fbos[currentTargetBuffer] ? fbos[currentTargetBuffer]->texture() : 0);
796 if (!wrapperTextures[currentTargetBuffer])
797 wrapperTextures[currentTargetBuffer] = rhi->newTexture(QRhiTexture::RGBA8, deviceSize, 1, QRhiTexture::RenderTarget);
799 wrapperTextures[currentTargetBuffer]->setPixelSize(deviceSize);
800 if (!wrapperTextures[currentTargetBuffer]->createFrom({textureId, 0 }))
801 qWarning(
"QOpenGLWidget: Failed to create wrapper texture");
812 static_cast<QOpenGLExtensions *>(context->functions())->flushShared();
815 emit q->aboutToCompose();
821 emit q->frameSwapped();
832 QWidget *tlw = q->window();
838 requestedSamples = requestedFormat.samples();
839 requestedFormat.setSamples(0);
841 QRhi *rhi = QWidgetPrivate::rhi();
845 if (rhi && rhi->backend() != QRhi::OpenGLES2) {
846 qWarning(
"The top-level window is not using OpenGL for composition, '%s' is not compatible with QOpenGLWidget",
854 QOpenGLContext *contextFromRhi = rhi ?
static_cast<
const QRhiGles2NativeHandles *>(rhi->nativeHandles())->context :
nullptr;
856 context =
new QOpenGLContext;
857 context->setFormat(requestedFormat);
859 QOpenGLContext *shareContext = contextFromRhi ? contextFromRhi : qt_gl_global_share_context();
861 context->setShareContext(shareContext);
862 context->setScreen(shareContext->screen());
864 if (Q_UNLIKELY(!context->create())) {
865 qWarning(
"QOpenGLWidget: Failed to create context");
869 surface =
new QOffscreenSurface;
870 surface->setFormat(context->format());
871 surface->setScreen(context->screen());
874 if (Q_UNLIKELY(!context->makeCurrent(surface))) {
875 qWarning(
"QOpenGLWidget: Failed to make context current");
882 if (tlw->windowHandle()) {
883 QSurfaceFormat tlwFormat = tlw->windowHandle()->format();
884 if (requestedFormat.swapInterval() != tlwFormat.swapInterval()) {
887 tlwFormat.setSwapInterval(requestedFormat.swapInterval());
888 tlw->windowHandle()->setFormat(tlwFormat);
890 if (requestedFormat.swapBehavior() != tlwFormat.swapBehavior()) {
891 tlwFormat.setSwapBehavior(requestedFormat.swapBehavior());
892 tlw->windowHandle()->setFormat(tlwFormat);
896 paintDevice =
new QOpenGLWidgetPaintDevice(q);
897 paintDevice->setSize(q->size() * q->devicePixelRatio());
898 paintDevice->setDevicePixelRatio(q->devicePixelRatio());
907 resolveSamplesForBuffer(QOpenGLWidget::LeftBuffer);
908 resolveSamplesForBuffer(QOpenGLWidget::RightBuffer);
914 if (resolvedFbos[targetBuffer]) {
915 q->makeCurrent(targetBuffer);
916 QRect rect(QPoint(0, 0), fbos[targetBuffer]->size());
917 QOpenGLFramebufferObject::blitFramebuffer(resolvedFbos[targetBuffer], rect, fbos[targetBuffer], rect);
929 setCurrentTargetBuffer(QOpenGLWidget::LeftBuffer);
931 QOpenGLContext *ctx = QOpenGLContext::currentContext();
933 qWarning(
"QOpenGLWidget: No current context, cannot render");
937 if (!fbos[QOpenGLWidget::LeftBuffer]) {
938 qWarning(
"QOpenGLWidget: No fbo, cannot render");
944 static bool warningGiven =
false;
945 if (!fbos[QOpenGLWidget::RightBuffer] && !warningGiven) {
946 qWarning(
"QOpenGLWidget: Stereo is enabled, but no right buffer. Using only left buffer");
951 if (updateBehavior == QOpenGLWidget::NoPartialUpdate && hasBeenComposed) {
954 if (stereo && fbos[QOpenGLWidget::RightBuffer]) {
955 setCurrentTargetBuffer(QOpenGLWidget::RightBuffer);
957 setCurrentTargetBuffer(QOpenGLWidget::LeftBuffer);
963 QOpenGLFunctions *f = ctx->functions();
964 f->glViewport(0, 0, q->width() * q->devicePixelRatio(), q->height() * q->devicePixelRatio());
968 f->glDepthMask(GL_TRUE);
971 QOpenGLContextPrivate::get(ctx)->defaultFboRedirect = fbos[currentTargetBuffer]->handle();
974 f->glBindBuffer(GL_ARRAY_BUFFER, 0);
975 f->glEnable(GL_BLEND);
978 if (updateBehavior == QOpenGLWidget::NoPartialUpdate)
981 if (stereo && fbos[QOpenGLWidget::RightBuffer]) {
982 setCurrentTargetBuffer(QOpenGLWidget::RightBuffer);
983 QOpenGLContextPrivate::get(ctx)->defaultFboRedirect = fbos[currentTargetBuffer]->handle();
985 if (updateBehavior == QOpenGLWidget::NoPartialUpdate)
988 QOpenGLContextPrivate::get(ctx)->defaultFboRedirect = 0;
996 QOpenGLExtensions *f =
static_cast<QOpenGLExtensions *>(QOpenGLContext::currentContext()->functions());
997 if (f->hasOpenGLExtension(QOpenGLExtensions::DiscardFramebuffer)) {
998 const GLenum attachments[] = {
999 gl_color_attachment0,
1000 gl_depth_attachment,
1001 gl_stencil_attachment,
1005 gl_depth_stencil_attachment
1008 f->discardFramebuffer(GL_FRAMEBUFFER, GLsizei(std::size(attachments)), attachments);
1010 f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
1016 QOpenGLExtensions *f =
static_cast<QOpenGLExtensions *>(QOpenGLContext::currentContext()->functions());
1017 if (f->hasOpenGLExtension(QOpenGLExtensions::DiscardFramebuffer)) {
1018 const GLenum attachments[] = {
1019 gl_depth_attachment,
1020 gl_stencil_attachment,
1024 gl_depth_stencil_attachment
1027 f->discardFramebuffer(GL_FRAMEBUFFER, GLsizei(std::size(attachments)), attachments);
1033 delete fbos[QOpenGLWidget::LeftBuffer];
1034 fbos[QOpenGLWidget::LeftBuffer] =
nullptr;
1035 delete resolvedFbos[QOpenGLWidget::LeftBuffer];
1036 resolvedFbos[QOpenGLWidget::LeftBuffer] =
nullptr;
1038 delete fbos[QOpenGLWidget::RightBuffer];
1039 fbos[QOpenGLWidget::RightBuffer] =
nullptr;
1040 delete resolvedFbos[QOpenGLWidget::RightBuffer];
1041 resolvedFbos[QOpenGLWidget::RightBuffer] =
nullptr;
1048 return grabFramebuffer(QOpenGLWidget::LeftBuffer);
1061 if (targetBuffer == QOpenGLWidget::RightBuffer && !isStereoEnabled())
1062 targetBuffer = QOpenGLWidget::LeftBuffer;
1064 if (!fbos[targetBuffer])
1070 setCurrentTargetBuffer(targetBuffer);
1071 if (resolvedFbos[targetBuffer]) {
1072 resolveSamplesForBuffer(targetBuffer);
1073 resolvedFbos[targetBuffer]->bind();
1076 const bool hasAlpha = q->format().hasAlpha();
1077 QImage res = qt_gl_read_framebuffer(q->size() * q->devicePixelRatio(), hasAlpha, hasAlpha);
1078 res.setDevicePixelRatio(q->devicePixelRatio());
1083 if (resolvedFbos[targetBuffer]) {
1084 setCurrentTargetBuffer(targetBuffer);
1095 q->setAutoFillBackground(
true);
1104 return q->format().stereo();
1109 return setCurrentTargetBuffer(currentTargetBuffer == QOpenGLWidget::LeftBuffer ?
1110 QOpenGLWidget::RightBuffer :
1111 QOpenGLWidget::LeftBuffer);
1120 if (!fbos[currentTargetBuffer] || q->size() * q->devicePixelRatio() != fbos[currentTargetBuffer]->size()) {
1127
1128
1129QOpenGLWidget::QOpenGLWidget(QWidget *parent, Qt::WindowFlags f)
1130 : QWidget(*(
new QOpenGLWidgetPrivate), parent, f)
1133 if (Q_UNLIKELY(!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::RhiBasedRendering)
1134 || !QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)))
1135 qWarning(
"QOpenGLWidget is not supported on this platform.");
1137 d->setRenderToTexture();
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157QOpenGLWidget::~QOpenGLWidget()
1170
1171
1172
1173void QOpenGLWidget::setUpdateBehavior(UpdateBehavior updateBehavior)
1176 d->updateBehavior = updateBehavior;
1180
1181
1182
1183QOpenGLWidget::UpdateBehavior QOpenGLWidget::updateBehavior()
const
1185 Q_D(
const QOpenGLWidget);
1186 return d->updateBehavior;
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206void QOpenGLWidget::setFormat(
const QSurfaceFormat &format)
1209 if (Q_UNLIKELY(d->initialized)) {
1210 qWarning(
"QOpenGLWidget: Already initialized, setting the format has no effect");
1214 d->requestedFormat = format;
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233QSurfaceFormat QOpenGLWidget::format()
const
1235 Q_D(
const QOpenGLWidget);
1236 return d->initialized ? d->context->format() : d->requestedFormat;
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255void QOpenGLWidget::setTextureFormat(GLenum texFormat)
1258 if (Q_UNLIKELY(d->initialized)) {
1259 qWarning(
"QOpenGLWidget: Already initialized, setting the internal texture format has no effect");
1263 d->textureFormat = texFormat;
1267
1268
1269
1270
1271
1272
1273
1274GLenum QOpenGLWidget::textureFormat()
const
1276 Q_D(
const QOpenGLWidget);
1277 return d->textureFormat;
1281
1282
1283
1284
1285bool QOpenGLWidget::isValid()
const
1287 Q_D(
const QOpenGLWidget);
1288 return d->initialized && d->context->isValid();
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301void QOpenGLWidget::makeCurrent()
1304 if (!d->initialized)
1307 d->context->makeCurrent(d->surface);
1309 if (d->fbos[d->currentTargetBuffer])
1310 d->fbos[d->currentTargetBuffer]->bind();
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328void QOpenGLWidget::makeCurrent(TargetBuffer targetBuffer)
1331 if (!d->initialized)
1335 if (targetBuffer == TargetBuffer::RightBuffer && !format().stereo())
1338 d->setCurrentTargetBuffer(targetBuffer);
1342
1343
1344
1345
1346
1347
1348void QOpenGLWidget::doneCurrent()
1351 if (!d->initialized)
1354 d->context->doneCurrent();
1358
1359
1360
1361
1362
1363
1364
1365QOpenGLContext *QOpenGLWidget::context()
const
1367 Q_D(
const QOpenGLWidget);
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383GLuint QOpenGLWidget::defaultFramebufferObject()
const
1385 Q_D(
const QOpenGLWidget);
1386 return d->fbos[TargetBuffer::LeftBuffer] ? d->fbos[TargetBuffer::LeftBuffer]->handle() : 0;
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405GLuint QOpenGLWidget::defaultFramebufferObject(TargetBuffer targetBuffer)
const
1407 Q_D(
const QOpenGLWidget);
1408 return d->fbos[targetBuffer] ? d->fbos[targetBuffer]->handle() : 0;
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424void QOpenGLWidget::initializeGL()
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439void QOpenGLWidget::resizeGL(
int w,
int h)
1446
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
1478void QOpenGLWidget::paintGL()
1482 d->context->functions()->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
1486
1487
1488
1489
1490
1491
1492
1493
1494void QOpenGLWidget::resizeEvent(QResizeEvent *e)
1498 if (e->size().isEmpty()) {
1499 d->fakeHidden =
true;
1502 d->fakeHidden =
false;
1505 if (!d->initialized)
1512 resizeGL(width(), height());
1513 d->sendPaintEvent(QRect(QPoint(0, 0), size()));
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527void QOpenGLWidget::paintEvent(QPaintEvent *e)
1533 if (d->initialized) {
1534 d->ensureRhiDependentResources();
1535 if (updatesEnabled())
1541
1542
1543
1544
1545
1546QImage QOpenGLWidget::grabFramebuffer()
1549 return d->grabFramebuffer();
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563QImage QOpenGLWidget::grabFramebuffer(TargetBuffer targetBuffer)
1566 return d->grabFramebuffer(targetBuffer);
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579QOpenGLWidget::TargetBuffer QOpenGLWidget::currentTargetBuffer()
const
1581 Q_D(
const QOpenGLWidget);
1582 return d->currentTargetBuffer;
1586
1587
1588int QOpenGLWidget::metric(QPaintDevice::PaintDeviceMetric metric)
const
1590 Q_D(
const QOpenGLWidget);
1591 if (d->inBackingStorePaint)
1592 return QWidget::metric(metric);
1594 auto window = d->windowHandle(QWidgetPrivate::WindowHandleMode::TopLevel);
1595 QScreen *screen = window ? window->screen() : QGuiApplication::primaryScreen();
1597 const float dpmx = qt_defaultDpiX() * 100. / 2.54;
1598 const float dpmy = qt_defaultDpiY() * 100. / 2.54;
1609 return width() * screen->physicalSize().width() / screen->geometry().width();
1611 return width() * 1000 / dpmx;
1614 return height() * screen->physicalSize().height() / screen->geometry().height();
1616 return height() * 1000 / dpmy;
1621 return qRound(screen->logicalDotsPerInchX());
1623 return qRound(dpmx * 0.0254);
1626 return qRound(screen->logicalDotsPerInchY());
1628 return qRound(dpmy * 0.0254);
1629 case PdmPhysicalDpiX:
1631 return qRound(screen->physicalDotsPerInchX());
1633 return qRound(dpmx * 0.0254);
1634 case PdmPhysicalDpiY:
1636 return qRound(screen->physicalDotsPerInchY());
1638 return qRound(dpmy * 0.0254);
1639 case PdmDevicePixelRatio:
1640 return QWidget::metric(metric);
1641 case PdmDevicePixelRatioScaled:
1642 return QWidget::metric(metric);
1643 case PdmDevicePixelRatioF_EncodedA:
1645 case PdmDevicePixelRatioF_EncodedB:
1646 return QWidget::metric(metric);
1648 qWarning(
"QOpenGLWidget::metric(): unknown metric %d", metric);
1654
1655
1656QPaintDevice *QOpenGLWidget::redirected(QPoint *p)
const
1658 Q_D(
const QOpenGLWidget);
1659 if (d->inBackingStorePaint)
1660 return QWidget::redirected(p);
1662 return d->paintDevice;
1666
1667
1668QPaintEngine *QOpenGLWidget::paintEngine()
const
1670 Q_D(
const QOpenGLWidget);
1674 if (d->inBackingStorePaint)
1675 return QWidget::paintEngine();
1677 if (!d->initialized)
1680 return d->paintDevice->paintEngine();
1688 if (targetBuffer == QOpenGLWidget::RightBuffer && !isStereoEnabled())
1691 currentTargetBuffer = targetBuffer;
1698
1699
1700bool QOpenGLWidget::event(QEvent *e)
1703 switch (e->type()) {
1704 case QEvent::WindowAboutToChangeInternal:
1705 d->resetRhiDependentResources();
1707 case QEvent::WindowChangeInternal:
1708 if (QCoreApplication::testAttribute(Qt::AA_ShareOpenGLContexts))
1716 if (d->initialized && !d->wrapperTextures[d->currentTargetBuffer] && window()->windowHandle()) {
1719 if (!QCoreApplication::testAttribute(Qt::AA_ShareOpenGLContexts))
1723 if (!d->initialized && !size().isEmpty()) {
1725 if (d->initialized) {
1730 d->sendPaintEvent(QRect(QPoint(0, 0), size()));
1735 case QEvent::DevicePixelRatioChange:
1736 if (d->initialized && d->paintDevice->devicePixelRatio() != devicePixelRatio())
1742 return QWidget::event(e);
1747#include "moc_qopenglwidget.cpp"
Combined button and popup list for selecting options.