I created a test plugin as a Qt5 / QML shared library using the Qt Quick 2 Extension Plugin design library in QtCreator. My development environment is Linux with Qt-5.0.0 and QtCreator-2.6 (the detail is added below).
Source files (default): https://gist.github.com/4467883
Source files are generated by default without any changes . The project name is "untitled", uri is "com.mycompany.mycomponents", and the object class name is "MyItem". Source files in "/ tmp / untitled" as SRCDIR.
And create it to output the library file as "libuntitled.so", "qmldir" and some object files in "/ tmp / untitled-build" as DESTDIR.
$ ls /tmp/untitled-build Makefile libuntitled.so moc_myitem.cpp moc_myitem.o moc_untitled_plugin.cpp moc_untitled_plugin.o myitem.o qmldir untitled_plugin.o
But I can not use the library on the "/tmp/test/test.qml" page as a QML test source using the qmlscene command.
$ mkdir /tmp/test; cd /tmp/test $ vim test.qml
"test.qml" (default): https://gist.github.com/4474422
$ qmlscene test.qml
This is fail , and QML_IMPORT_TRACE :
QQmlImportDatabase::addImportPath: "/usr/lib64/qt5/qml" QQmlImportDatabase::addImportPath: "/usr/bin" QQmlImports(file:///tmp/test/test.qml)::addImplicitImport QQmlImports(file:///tmp/test/test.qml)::addLibraryImport: "QtQuick" 2.0 as "" QQmlImports(file:///tmp/test/test.qml)::importExtension: loaded "/usr/lib64/qt5/qml/QtQuick.2/qmldir" QQmlImportDatabase::importPlugin: "QtQuick" from "/usr/lib64/qt5/qml/QtQuick.2/libqtquick2plugin.so" file:///tmp/test/test.qml:2 module "com.mycompany.mycomponents" is not installed
And try the "-I" option:
$ qmlscene test.qml -I /tmp/untitled-build
This one does not work . log:
QQmlImportDatabase::addImportPath: "/usr/lib64/qt5/qml" QQmlImportDatabase::addImportPath: "/usr/bin" QQmlImportDatabase::addImportPath: "/tmp/untitled-build" QQmlImports(file:///tmp/test/test.qml)::addImplicitImport QQmlImports(file:///tmp/test/test.qml)::addLibraryImport: "QtQuick" 2.0 as "" QQmlImports(file:///tmp/test/test.qml)::importExtension: loaded "/usr/lib64/qt5/qml/QtQuick.2/qmldir" QQmlImportDatabase::importPlugin: "QtQuick" from "/usr/lib64/qt5/qml/QtQuick.2/libqtquick2plugin.so" file:///tmp/test/test.qml:2 module "com.mycompany.mycomponents" is not installed
And try using "/ tmp / test / qmldir":
$ vim /tmp/test/qmldir
"tmp / test / qmldir" (default): https://gist.github.com/4474497
This does not work . to come in:
QQmlImportDatabase::addImportPath: "/usr/lib64/qt5/qml" QQmlImportDatabase::addImportPath: "/usr/bin" QQmlImports(file:///tmp/test/test.qml)::addImplicitImport QQmlImports(file:///tmp/test/test.qml)::importExtension: loaded "/tmp/test/qmldir" QQmlImportDatabase::importPlugin: ".tmp.test" from "/tmp/untitled-build/libuntitled.so" Module '.tmp.test' does not contain a module identifier directive - it cannot be protected from external registrations. QQmlImports(file:///tmp/test/test.qml)::addLibraryImport: "QtQuick" 2.0 as "" QQmlImports(file:///tmp/test/test.qml)::importExtension: loaded "/usr/lib64/qt5/qml/QtQuick.2/qmldir" QQmlImportDatabase::importPlugin: "QtQuick" from "/usr/lib64/qt5/qml/QtQuick.2/libqtquick2plugin.so" file:///tmp/test/test.qml:2 module "com.mycompany.mycomponents" is not installed
How to use library ("/tmp/untitled-build/libuntitled.so") in test .qml ("/tmp/test.qml") with qmlscene (or qmlviewer5)?
Description of the environment (based on openSUSE-12.2):
$ uname -a Linux LH-MAIN 3.4.11-2.16-desktop
Literature: