Hello, I have a quite big QWidgets based application and I am considering migrating portions of it to use Qt Quick Controls 2. I'm new to QML/QtQuick, so I decided to start very simple and test how to migrate my About dialog (QDialog).
I tried replacing AboutDialog dlg(this); dlg.exec() with auto *widget = new QQuickWidget(); widget->setAttribute(Qt::WA_DeleteOnClose); widget->resize(600,300); widget->setResizeMode(QQuickWidget::SizeRootObjectToView ); widget->setSource(QUrl(QStringLiteral("qrc:qml/about.qml"))); widget->show(); This sort of worked. But if I in my QML used a Window or Dialog as root entity, 2 windows opened, a black window for the QQuickWidget and another window with the about dialog. If I changed the root entity to a Rectangle instead, then the about QML was drawn in the correct window. However, I have a Close button that should close the dialog. This has no effect right now. I haven't found a way to connect the click on the close button to the closing of the QQuickWidget. So the question is, what is the best way for migrating a QWidgets based dialog to a Qt Quick Controls based dialog? Should I not use QQuickWidget for standalone dialogs, but instead trigger the QML in another way? Or embed the QQuickWidget inside a QDialog? Or use QQmlApplicationEngine directly? Best regards, Harald
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest