Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Issue using QQuickWidget with a resource qml file in a plugin
xavi-b last edited by xavi-b
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:
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):
and the widget returned an error (when loaded in the main application): "file:///path/to/my/app/executable/: file to open is a directory"
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 ?
xavi-b last edited by
Solution is to use:
QUrl apparently needs qrc:/ and not just :/