Solved Creating shared libarary
-
How to create dll file which includes qml files and how to use the same in another qml file.
-
@jayshetti
Here you go -
@raven-worx i have seen this example i'm able to create dll file but unable to use it in other project,
need some step by step guidelines. -
@jayshetti
what is the error, what isn't working exactly?Note that you can only load dbeug libraries in debug builds and the same respectivly for release.
Also when place the DLL and the qmldir file in the Qt dir (e.g.C:\Qt\Qt5.7.0-msvc2015\5.7\msvc2015\qml\MyModule
) it will be loaded by Qt automatically. -
@raven-worx i'll tell you what i exactly want to do
i have created QT quick2 extension plugin library project in this project i have to have one qml file that draws one simple circle
i have to use the plugin i.e generated by extension plugin into other qt quick application to draw the circle
How to achieve this task if you give me step by step guidelines it would be helpful. -
@jayshetti
did you read the link i've already posted? This actually contains everything to know.
As i already said, once the plugin is built copy it to your Qt's qml directory and it can be loaded by other applications.I wont post a step-by-step guide, when there is everything already in the docs. If you have a specific question ask it.
-
@raven-worx i'm able to load the plugin successfully but i'm facing problem in loading qml component in this link they have used Clock.qml and plugins.qml how should i access that Clock.qml file in my application through plugin if i simply used Clock as component it showing me an erorr.
-
@jayshetti
in this example the Clock.qml is located in the file system.Place your QML files in a qrc file and compile it into the plugin.
Then in your qmldir file you can also specify a qrc:// url, to make it look like this:module MyModule plugin mymodule MyType 1.0 qrc:///path/to/MyType.qml
or leave out the list of QML files in the qmldir file and register the types in the plugins
registerTypes()
method:void registerTypes(const char *uri) { Q_ASSERT(uri == QLatin1String("MyModule")); qmlRegisterType( QUrl::fromUserIntput("qrc:///path/to/MyType.qml"), uri, 1, 0, "MyType"); }
Then use
import MyModule 1.0
to load your plugin. -
@raven-worx Thank you it worked nw