Unsolved How to nest QWidget in QML?
-
I now need to nest a player window in QML, but the player window is developed using QWidget.
I found a way, but I can't handle the QML level problem, the player window will always be blocked on the QML interface.
QQmlApplicationEngine engine; const QUrl url(QStringLiteral("qrc:/main.qml")); engine.load(url); QObject *qmlObj = engine.rootObjects().first(); QWindow *qmlWindow = qobject_cast<QWindow *>(qmlObj); QWidget *fm = new QWidget(); fm->winId(); fm->setAttribute(Qt::WA_NativeWindow); fm->windowHandle()->setParent(qmlWindow); fm->move(40, 40); fm->show();
How can I nest QWidget into QML, just like QML Item.
please help me.
-
This is not possible. No QWidgets inside the qml.
-
Hi
This might be interesting
https://www.kdab.com/declarative-widgets/
But else @dheerendra is right and its really not natively supported. -
We allways need QWidget in QML, does anyone else has some ideas?
Thanks for help. -
@kate-he You can always go the other way, and make your application a QWidget application and load Qml stuff via QQuickView and/or QQuickWidgets
-
@J-Hilk Thanks for ur ideas and We've thought about that before.
If we do what you say, that means we need to refactor our exsiting project.
That would be a huge job, which can't be done in a very short time.Are there any paid services in QT official, that can be customized for us to make QWidget embedded in QML possible?
-