[SailfishDevel] Installation of import packages on Qt5 Alpha Emulator: Solved (I think)

christopher.lamb at thurweb.ch christopher.lamb at thurweb.ch
Sat Aug 3 11:39:15 UTC 2013


HI all

I think I have managed to solve this problem.

First, just to simplify things I created a new project TestLib of type  
"Libraries / QT Quick 2 Extension Plugin". I gave this the url  
"org.flyingsheep.testlib"

As this is a throwaway demo I made no change to the code.

Next I created a thowaway Sailfish QML project TestLibImport using the  
standard "Hello Sailors" template. The only change I made was to add  
"import org.flyingsheep.testlib 1.0"

This gave me a simple, pure Qt5 / Sailfish Silica testbed to play with.

Next I "installed" the library on the SDK and Emulator. Based on my  
experience with the Qt 4 Sailfish Alpha, I chose the install location  
as:

SDK: /usr/lib/qt5/imports
(this is available on the host via)
/Users/<your  
homedrive>/SailfishOSAlpha5/mersdk/targets/SailfishOS-i486-x86/usr/lib/qt5/imports

Emulator: /usr/lib/qt5/imports

Then I hit the QtCreator Compile and Run Button to run TestLibImports.

This gave the same error: 'module "org.flyingsheep.testlib" is not installed'.

So it seemed to me clear that I was installing in the wrong place.

Then it struck me: but the import to Sailfish.Silica works? So where  
are those files.

So I did a quick search for SilicaFlickable.qml on the Emulator:

find / -name SilicaFlickable.qml
/usr/lib/qt5/qml/Sailfish/Silica/SilicaFlickable.qml

So it looks like the install location should be /usr/lib/qt5/qml as  
opposed to /usr/lib/qt5/imports (or /usr/lib/qt4/imports on the old  
alpha).

And yes, if I install TestLib in /usr/lib/qt5/imports, then  
TestLibImport runs!

So the question is: Is /usr/lib/qt5/imports now the official correct  
place to install import libraries?

Grüsse

Chris


Zitat von Superpelican <superpelican at zoho.com>:

> Yes, that was indeed what I had read, I was just going to send the  
> link to the mailinglist ;)
> Well I don't think I can help with a C++ plugin. I myself now just  
> use a C++ class which is in the same project as the QML UI to  
> interface with C++. That turned out to be easier,
>
> Superpelican
>
> On 08/03/2013 11:33 AM, christopher.lamb at thurweb.ch wrote:
>> Hi Superpelican
>>
>> you probably read that here:
>> https://qt-project.org/doc/qt-5.1/qtdoc/qtquick-porting-qt5.html#qml-plugins "Individual file imports no longer work (for example, import "MyType.qml"). Import the containing directory  
>> instead."
>>
>> But what I am doing (trying to do) is different. I am importing a library.
>>
>> The library contains a whole set of qml components, a C++ plugin  
>> defining types, a qmldir file and a plugins.qmltypes file.
>>
>> A "standard" Qt4 equivalent is the nokia meego components which  
>> would be imported with "import com.nokia.meego 1.0"
>>
>> Having done some more thinking myself, I now think the problem  
>> could be that the library itself must first be migrated to Qt5. In  
>> a hurry to get things working i had just copied across the old Qt4  
>> version. In all probabilities it maybe in the right place but won't  
>> work on Qt5.
>>
>> Thanks for the hint
>>
>> Chris
>>
>>
>> Zitat von Superpelican <superpelican at zoho.com>:
>>
>>> Hello,
>>>
>>> I read on a wiki/docs page on qt-project.org yesterday that it  
>>> isn't possible anymore to import a single .qml, where this was  
>>> possible in Qt 4.8. Instead you now have to import the directory  
>>> where the .qml is located in. I don't know on which page I read,  
>>> but I can look it up when I'm behind my laptop again. It was one  
>>> of the differences between Qt 4
>>> 4 and 5/porting to Qt5 pages though.
>>>
>>> Hope this is helpful,
>>>
>>> Superpelican
>>>
>>> On Fri Aug   2 2013 11:39:46 PM CEST, christopher.lamb at thurweb.ch wrote:
>>>
>>>> Hi All
>>>>
>>>> Is there anything different about where Qt import packages should be
>>>> installed on the Qt5 Alpha Emulator?
>>>>
>>>> By "import package" I mean the sort of thing that you import to a qml
>>>> file as follows
>>>>
>>>> import org.flyingsheep.abstractui 1.0
>>>>
>>>> In the old Qt 4.8.3 Alpha Emulator I installed my package in
>>>> /usr/lib/qt4/imports
>>>>
>>>> On the new Qt 5 Alpha Emulator I have installed the package under
>>>> /usr/lib/qt5/imports
>>>>
>>>> i.e. in the Qt5 imports directory rather than the Qt4 equivalent.
>>>>
>>>> However when I try and run an app importing this package in QtCreator
>>>> I get the following error:
>>>>
>>>> file:///opt/sdk/landedsettingsQt5_21/usr/share/landedsettingsQt5_21/main.qml:2:1: module "org.flyingsheep.abstractui" is not      
>>>> installed
>>>>
>>>> Any ideas?
>>>>
>>>> Chris
>>>>
>>>>
>>>> _______________________________________________
>>>> SailfishOS.org Devel mailing list
>>>
>>>
>>
>>
>
>
>




More information about the Devel mailing list