About integrating c++ and qml
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
thanks Duff but I find this concept very difficult .
Check out this page in the documentation. This is how I figured out how to integrate my c++ class ...
Thanks Duff, sometimes in the tutorials they say extending qml from c++ and sometimes they say extending c++ from qml do you know what are the differences.
Well, it goes both ways. You can access c++ classes from QML and access QML objects from C++. Just depends on what you are trying to accomplish.
ok , what about the wrapper object when should I use it and what does it d exactly?