how to use QML items in a QWidget MainForm.ui
-
hi guys,
i create an app for desktop, a quick widget app, and recently i discover (via this forum) the qml and qt quick, for improve visual and add animation
i want to incorporate on my old Qt widget app some animated items, from a QML file, but dont know if i can, and, i that case, how to insert themreading on the qt docs im proving something like > create a QQuickWidget, and setting it the source via > ui.quickwidgetName.setsource("url");
ui.quickwidgetName.show();
but the program dont run, send me various errors, almost all say that>
C:\Users\erto\mainwindow.cpp:28: error: undefined reference to `_imp___ZN12QQuickWidget9setSourceERK4QUrl'i dont how to do what i want
-
@Cuban-Akira hi
see if this helps https://forum.qt.io/topic/81264/add-qml-objects-to-your-c-widget-application -
@LeLev
so usefull your answer, thanks, but im have another problem
when i run the app on debug mode the QQuickWidget display ok, and work perfect
but when i change to relase mode and run the app the QQuickWidget is blank, dont show anything, what i missing?? -
@Cuban-Akira
I don't know Widgets sorry..In your qml component you can try to catch onCompleted signal
Component.onCompleted : console.log("qml file loaded")
also please give your Qt version and application output if there is, so someone with more experience can help you.
-
Either debug/release it should work the same. Can you show code how you are adding the QML items to Widget based App ?
-
@dheerendra said in how to use QML items in a QWidget MainForm.ui:
e it should work the same. Can you show code how you are adding the QML items to Widget b
i create the qquickwidget in the .ui
and then set his source
//"wid" is the name of the QQuickWidget object
ui->wid->setSource(QUrl("qrc:/Gi.qml"));
//and show him
ui->wid->show();