QQuickWidget no such file issue
-
Hi,
i'm having some problems displaying a qml code into a QWidget.
i'm using in this case QQuickwidget. But every time i use setLocationfrom, its telling me no such file or directory. see the code below !
i have change the location of the qml file and changed the syntax but still nothing.
my goal is to display a map in a QWidget
thanks for your helpw = new QQuickWidget; w->setSource(QUrl::fromLocalFile("file:///D:/ProjetRC/mainie.qml")); and file:///D:/build-ProjetRC-Desktop_Qt_5_10_1_MinGW_32bit-Debug/file:///D:/ProjetRC/mainie.qml: No such file or directory -
Hi and welcome to devnet,
Did you add
QT += quickwidgetsto your pro file ?
-
Did you de-run qmake after doing that ?
-
Sorry, I just realized that I missed the real missing file issue.
Remove the file:/// from your path. Since you are using QUrl to build it, just pass it the path to your file.
-
Thank you, its worked ! the error has gone but this appeared instead although the program is running :
QQuickWidget does not support using windows as a root item. If you wish to create your root window from QML, consider using QQmlApplicationEngine instead. -
You have to change the main element of your QML file.
Can you share it ?