Issue using QQuickWidget with a resource qml file in a plugin
Solved
QML and Qt Quick
-
Hi,
I'm currently developing an application loading several plugins (based on Qt plugins documentation).
Each plugin is creating a widget with a function like this one:QWidget* createWidget();
Everything worked fine and widgets were created and displayed until I decided to.. return a QQuickWidget !
I set its source to a qml file in a resource file (with a different name from other plugins' resource files to avoid conflict):this->setSource(QUrl(":/qml/MyQmlFile.qml"));
and the widget returned an error (when loaded in the main application): "file:///path/to/my/app/executable/: file to open is a directory"
Futher information:
QFile file(QUrl(":/qml/MyQmlFile.qml")); file.open(QIODevice::ReadOnly); // returns true this->setSource(QUrl("/path/to/my/plugin/qml/MyQmlFile.qml")); // works fine
Any ideas why QQuickWidget won't load my qml file when in a resource file ?