1
0
mirror of https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git synced 2025-04-01 02:42:39 +08:00

Fix weird behavior on demo examples with QQuickWidget and Image Viewer when undocking redocking

This commit is contained in:
Thibault GEFFROY 2025-03-20 15:23:10 +01:00
parent 4ff92dfd80
commit d57448bad7
No known key found for this signature in database
GPG Key ID: 30B5D581E60332E7

View File

@ -2,6 +2,7 @@
#include <QString> #include <QString>
#include <QFile> #include <QFile>
#include <QApplication> #include <QApplication>
#include <QQuickWindow>
#include <QDebug> #include <QDebug>
#include <memory> #include <memory>
@ -35,6 +36,14 @@ void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QS
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
// https://doc.qt.io/qt-6/qtdatavisualization-known-issues.html
// Use either `qputenv("QSG_RHI_BACKEND", "opengl");` or the following line
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
// Disable warnings when attempts are made to convert non-convertible non-native widgets
// to native widgets (such as QQuickWidget)
QApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#if QT_VERSION >= 0x050600 #if QT_VERSION >= 0x050600