[Qt-qml] How plugin paths should work

Jyrki Hämäläinen jyrki.hamalainen at nomovok.com
Fri Aug 6 12:38:49 CEST 2010


Hi Henrik,

Thanks for the tip.

Here is a trace. I have verified with two applications that the same 
problem occurs.
I am not able to enclose the code. But I can make a dummy project using 
same idioms if that is useful.

It seems that the plugin is actually found and but fails to use it.
Could this be a problem with automatic namespaces or something 
equivalent in QML?

--- clip ---
 > qmlviewer -P /opt/local/lib/testproject/ 
/opt/local/share/testproject/calculator.qml
QDeclarativeImportDatabase::addImportPath "/opt/qt4.7/imports"
QDeclarativeImportDatabase::addImportPath "/opt/qt4.7/bin"
QDeclarativeImportDatabase::addPluginPath "/opt/local/lib/testproject/"
QDeclarativeImportDatabase::addToImport 0xa07a2b4 "." -1.-1 File as ""
QDeclarativeImportDatabase::add: loaded 
"/opt/local/share/testproject/qmldir"
QDeclarativeImportDatabase::importPlugin ".opt.local.share.testproject" 
from "/opt/local/lib/testproject/libmaxcalcengine-plugin.so"
QDeclarativeImportDatabase::addToImport 0xa07a2b4 "Qt" 4.7 Library as ""
QDeclarativeImportDatabase::addToImport 0xa07a2b4 "CalcUtils" -1.-1 File 
as ""
QDeclarativeImportDatabase::add: loaded 
"/opt/local/share/testproject/CalcUtils/qmldir"
QDeclarativeImportDatabase::importPlugin 
".opt.local.share.testproject.CalcUtils" from 
"/opt/local/lib/testproject/libmaxcalcengine-plugin.so"
QDeclarativeImportDatabase::resolveType "Rectangle" = 
"QDeclarativeRectangle"
QDeclarativeImportDatabase::resolveType "Parser" = "Parser"
QDeclarativeImportDatabase::resolveType "SystemPalette" = 
"QDeclarativeSystemPalette"
QDeclarativeImportDatabase::resolveType "Row" = "QDeclarativeRow"
QDeclarativeImportDatabase::resolveType "Column" = "QDeclarativeColumn"
QDeclarativeImportDatabase::resolveType "Display" =  QUrl( 
"file:///opt/local/share/testproject/CalcUtils/Display.qml" )
QDeclarativeImportDatabase::addToImport 0xa0cd4f4 "." -1.-1 File as ""
QDeclarativeImportDatabase::add: loaded 
"/opt/local/share/testproject/CalcUtils/qmldir"
QDeclarativeImportDatabase::importPlugin 
".opt.local.share.testproject.CalcUtils" from 
"/opt/local/lib/testproject/libmaxcalcengine-plugin.so"
QDeclarativeImportDatabase::addToImport 0xa0cd4f4 "Qt" 4.7 Library as ""
QDeclarativeImportDatabase::resolveType "Rectangle" = 
"QDeclarativeRectangle"
QDeclarativeImportDatabase::resolveType "TextInput" = 
"QDeclarativeTextInput"
QDeclarativeImportDatabase::resolveType "Text" = "QDeclarativeText"
QDeclarativeImportDatabase::resolveType "State" = "QDeclarativeState"
QDeclarativeImportDatabase::resolveType "PropertyChanges" = 
"QDeclarativePropertyChanges"
QDeclarativeImportDatabase::resolveType "Transition" = 
"QDeclarativeTransition"
QDeclarativeImportDatabase::resolveType "NumberAnimation" = 
"QDeclarativeNumberAnimation"
QDeclarativeImportDatabase::resolveType "HistoryList" =  QUrl( 
"file:///opt/local/share/testproject/CalcUtils/HistoryList.qml" )
QDeclarativeImportDatabase::addToImport 0xa1281cc "." -1.-1 File as ""
QDeclarativeImportDatabase::add: loaded 
"/opt/local/share/testproject/CalcUtils/qmldir"
QDeclarativeImportDatabase::importPlugin 
".opt.local.share.testproject.CalcUtils" from 
"/opt/local/lib/testproject/libmaxcalcengine-plugin.so"
QDeclarativeImportDatabase::addToImport 0xa1281cc "Qt" 4.7 Library as ""
QDeclarativeImportDatabase::resolveType "Item" = "QDeclarativeItem"
file:///opt/local/share/testproject/calculator.qml:54:6: Type 
HistoryList unavailable
              HistoryList {
              ^
file:///opt/local/share/testproject/CalcUtils/HistoryList.qml:37:2: 
Parser is not a type
          Parser {
          ^
--- clip ---



06.08.2010 10:32, henrik.hartz at nokia.com kirjoitti:
> Hi Jyrki,
>
> While not having a solution to your problem without the full source available, you might find that using QML_IMPORT_TRACE environment variable to see what's happening with your module plugins;
>
> http://doc.qt.nokia.com/4.7-snapshot/qdeclarativedebugging.html
>
> Hope this helps!
> Henrik
>
> On 6. aug. 2010, at 09.14, ext Jyrki Hämäläinen wrote:
>
>    
>> Hello everyone,
>>
>> We are trying to build a suite of applications with QML.
>> Some of the applications need to share C++-plugins.
>>
>> Also to enhance the structure of the application, some applications use
>> subfolders to group related qml-files into modules.
>>
>> The application structure would be like this
>>
>> /xxx/qmlapp/main.qml  -->  plugin_a, module1/mod1_a.qml, module1/mod1_b.qml
>> /xxx/qmlapp/qmldir
>> /xxx/qmlapp/module1/mod1_a.qml -->  plugin_a
>> /xxx/qmlapp/module1/mod1_b.qml
>> /xxx/qmlapp/module1/qmldir
>>
>> /yyy/libs/libplugin_a.so
>>
>>
>> Where
>> main.qml uses 'import "module1"', to import qml files in subfolder module1.
>> main.qml ja qml-module located in the subfolder use the shared plugin.
>>
>> Also qmldir files have content as follows
>> /xxx/qmlapp/qmldir:
>> plugin plugin_a
>>
>> /xxx/qmlapp/module1/qmldir
>> plugin plugin_a
>> Mod1_A mod1_a.qml
>> Mod1_B mod1_b.qml
>>
>> We are trying to run the application like this
>> qmlviewer -P /yyy/libs/ /xxx/qmlapp/main.qml
>>
>> The problem is that for some reason the plugin (or the types registered
>> by the plugin) cannot be found when parsing the qml-file located in the
>> subfolder.
>>
>> If all QML files (that are using the plugin - I suppose) are located in
>> the same folder. Everything seems to run smoothly.
>>
>>
>> I was wondering if someone has bumped into same or similar problem and
>> perhaps even found a solution / workaround.
>> This seems like a trivial use case to me and its hard to imagine this
>> would be a problem on QML framework side.
>> Just cannot locate the problem on our side setup either.
>>
>> I really would appreciate any pointers on this issue.
>>
>> Best Regards,
>> -- 
>> Jyrki Hämäläinen
>> _______________________________________________
>> Qt-qml mailing list
>> Qt-qml at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-qml
>>      
>    




More information about the Qt-qml mailing list