Skip to content

Commit d5843ff

Browse files
Documented the use of Qt::AA_ShareOpenGLContexts when using OpenGL with ADS
1 parent c135782 commit d5843ff

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

demo/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ int main(int argc, char *argv[])
4141
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
4242
#endif
4343
#endif
44+
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
4445
std::shared_ptr<int> b;
4546
QApplication a(argc, argv);
4647
a.setApplicationName("Advanced Docking System Demo");

doc/user-guide.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
- [Supported Distributions](#supported-distributions)
7474
- [Requirements](#requirements)
7575
- [Manjaro xfce 25.0.1 and Xubuntu 24.04.2 issues](#manjaro-xfce-2501-and-xubuntu-24042-issues)
76+
- [OpenGl + ADS](#opengl--ads)
7677

7778
## Configuration Flags
7879

@@ -990,3 +991,18 @@ can be solved by enabling the setting **Activate focus stealing prevention**. `S
990991
Selecting `Activate focus stealing prevention` and `Do nothing` for `When a window raises itself`, seems to mitigate the issue. Deselecting `Enable display compositing` on the `Compositor` tab, also works.
991992
992993
![Window Manager Tweaks](xfce4_focus_stealing_issue.png)
994+
995+
## OpenGl + ADS
996+
997+
If you would like to use OpenGL widgets with ADS such as `GLWidget`, QML or `QWebEngineView`, then you need
998+
to set `QApplication::setAttribute(Qt::AA_ShareOpenGLContexts)` before creating your application and your
999+
widgets (see issue [#732])
1000+
1001+
```c++
1002+
int main(int argc, char *argv[])
1003+
{
1004+
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
1005+
QApplication application(argc, argv);
1006+
...
1007+
}
1008+
```

0 commit comments

Comments
 (0)