We have moved to a new Sailfish OS Forum. Please start new discussions there.
2

Importing private QML modules

asked 2014-01-28 19:23:59 +0300

juke gravatar image

updated 2014-01-28 19:56:45 +0300

Because of Harbour rules, I need to ship my app with QtWebKit.experimental but I'm having hard time importing it from shared private library location.

This is how my /usr/share/$NAME looks like.

/usr/share/harbour-app/
    qml/
        main.qml
        ...
        experimental/
            libqmlwebkitexperimentalplugin.so
            qmldir

And qmldir contains:

module harbour.app.qtwebkit.experimental
plugin qmlwebkitexperimentalplugin

When trying to use the module from .qml file I get

[W] unknown:4 - file:///usr/share/harbour-app/qml/pages/SettingView.qml:4:1: module "harbour.app.qtwebkit.experimental" is not installed 
     import harbour.app.qtwebkit.experimental 1.0 
     ^

How is this done correctly?

Edit:

I have set in .pro file

QML2_IMPORT_PATH += /usr/share/$$TARGET/qml
QML_IMPORT_PATH += /usr/share/$$TARGET/qml

but it doesn't help.

edit retag flag offensive close delete

1 Answer

Sort by » oldest newest most voted
3

answered 2014-01-28 20:41:25 +0300

juke gravatar image

I needed to add a line to my main before loading qml resources:

view->engine()->addImportPath("/usr/share/app/qml/");

See docs.

And change the directory structure to match my import namespace:

/usr/share/harbour-app/
    qml/
        main.qml
        ...
        harbour/
            app/
                qtwebkit/
                    experimental/
                        libqmlwebkitexperimentalplugin.so
                        qmldir
edit flag offensive delete publish link more

Comments

Hi, I am facing the same issue here. Could you be so kind and share some more information. Is there a github repository I could take a look at?

I followed the advice you gave but I am getting an error when the app is running. The error says that my module is not installed. In the IDE my import statement #import [plugin name from qmldir] is red and I also get the information the QML module was not found and that I should use QML_IMPORT_PATH to add another location.

FloR707 ( 2017-08-12 00:12:38 +0300 )edit
Login/Signup to Answer

Question tools

Follow
2 followers

Stats

Asked: 2014-01-28 19:23:59 +0300

Seen: 4,114 times

Last updated: Jan 28 '14