About integrating c++ and qml
-
Hello ,
I would like to ask when should I use the qml register type and when to use the plugin.
Actually the concept is new to me and I feel confused and I don’t know from where to start.
I watched the video of Qt developer days 2011 It is discussing this task it clarified a little bit some concepts but I still find it ambiguous .
Thanks in advance. -
It looks like plugins are useful when you want to package a QML component or collection of components for the purpose of using them in different projects or making them available to other developers. I used register type in my main c++ program just to make a c++ class accessible from my QML code ...
qmlRegisterType<WorkerThread>("com.myapp.myclass", 1, 0, "MyApi");
and then import it in my qml file ...
import com.myapp.myclass 1.0
-
Check out this page in the documentation. This is how I figured out how to integrate my c++ class ...
http://qt-project.org/doc/qt-5/qtqml-cppintegration-topic.html