Skip to content

Commit d57448b

Browse files
committed
Fix weird behavior on demo examples with QQuickWidget and Image Viewer when undocking redocking
1 parent 4ff92df commit d57448b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

demo/main.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <QString>
33
#include <QFile>
44
#include <QApplication>
5+
#include <QQuickWindow>
56
#include <QDebug>
67

78
#include <memory>
@@ -35,6 +36,14 @@ void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QS
3536

3637
int main(int argc, char *argv[])
3738
{
39+
// https://doc.qt.io/qt-6/qtdatavisualization-known-issues.html
40+
// Use either `qputenv("QSG_RHI_BACKEND", "opengl");` or the following line
41+
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
42+
43+
// Disable warnings when attempts are made to convert non-convertible non-native widgets
44+
// to native widgets (such as QQuickWidget)
45+
QApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
46+
3847
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
3948
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
4049
#if QT_VERSION >= 0x050600

0 commit comments

Comments
 (0)