Expose QObject to QML
I try to use an old qt-lab called qmlscxml to load SCXML files to control a qml interface.
I need to expose a QObject to QML but I have the following error:
ReferenceError: Can't find variable: viewobject
I'm new with Qt but I read some doc and don't find what is wrong.
The code is below:
@int main(int argc, char ** argv)
qmlRegisterType<QmlScxml>("Scxml", 1, 0, "Scxml");
QApplication app(argc, argv);
QObject *viewobject = view.rootObject();
Component.onCompleted: registerObject(viewobject, "viewobject", true)
Thanks for your support!
I'm confused. Why are you trying to set rootObject as context in rootContext?
I use the qt-scxml project "Your text to link here...":http://qt.gitorious.org/qt-labs/scxml
I need to register the rootObject to the qstatemachine. Doing that I can acces from the scxml file to function defined in qml with: viewobject.dothis() or detect signal emit from the rootObject with: viewobject.timeout()