[Qt-interest] qml files and imports...

David Heremans david.heremans at intersoft-electronics.com
Thu Sep 15 16:23:42 CEST 2011


Hello,

I'm having a slight problem using QML files and some custom plugins.
The application I'm writing downloads the qml files from a server and
puts them in /tmp
I have my plugins in a directory '/tmp/components' and created the
'/tmp/components/qmldir' file etc etc.

If I use
    QDeclarativeView* view=new QDeclarativeView();
    view->setSource(QUrl::fromLocalFile(QString("/tmp/downloaded.qml")));
    view->show();
It works perfectly.

However....
I want to move the components directory in '/opt/QMLhelpers/'
I then tried to alter the code to
    QDeclarativeView* view=new QDeclarativeView();
    view->setSource(QUrl::fromLocalFile(QString("/tmp/downloaded.qml")));
    view->engine()->addImportPath("/opt/QMLhelpers/");
    view->engine()->addPluginPath("/opt/QMLhelpers/");
    view->show();

And now I get as error

file:///tmp/downloaded.qml:2:1: "components": no such directory

import "components"

^

I tried adding the path "/opt/QMLhelpers/components", adding an extra
qmldir with an extra 'plugin' line in /tmp, adding in /opt/QMLhelpers.
All things I tried kept resulting in the same error.

Can somebody explain me what it is that I'm missing here ?

rgds,

David H


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110915/1d9f3677/attachment.html 


More information about the Qt-interest-old mailing list