How can I use qml items from another project ?
-
I created my own qml objects and i want to use them in another project using import.
for example:the file c:\myObjectFolder\MyItems\myQmlItem.qml
@myQmlItem
{
....
}@in another project I want to do this:
@
import QtQuick 1.0
import MyItems 1.0myQmlItem
{
...
}
@is it possible?
-
Yes you can.
- Use uppercase starting names for the files.
- Use:
@import "path_to_a_folder_containing_the_files_defining_your_new_objects"@
The objects get named according their respective file names.
-
Not path to file but path to the folder with custom qml items.
And if you insist on using Import Sth 1.0, than AFAIK you'll need to write your own C++ extensions for qml.
"Tutorial: Writing QML extensions with C++":http://doc.qt.nokia.com/4.7/qml-extending-tutorial-index.html
"QML Modules":http://doc.qt.nokia.com/4.7/qdeclarativemodules.html#qml-modules -
I made a pair of example projects showing how to do this "here":http://developer.qt.nokia.com/forums/viewthread/7171/P30/#42472