[SailfishDevel] Does the Sailfish example application create a QDeclarativeEngine?

superpelican superpelican at zoho.com
Sat May 4 09:59:13 UTC 2013


Hello fellow SailfishDevel list members,
  
 I'm writing a QML/Sailfish Silica app that will use the logic of a CLI C++ application I had already written. I've also already created a QML/Silica UI. So I will need to let C++ and QML communicate (for example the C++ code has to know when a QML Button is clicked)
 and the C++ code will need to change the properties (for example text of a label) of QML items.
  
 I'm still quite new to programming and Qt/QML, so I'm still figuring out how to let C++ and QML communicate with each other (which is the most difficult part in programming for me until now). I'm currently reading Qt Docs QDeclarativeContext . The Qt Docs says that you should create a QDeclarativeContext object first to be able to change QML properties from C++, but to create a context you need to pass the QDeclarativeEngine object as a parameter:
 

  QDeclarativeContext *context = new QDeclarativeContext(engine.rootContext());
 

 However the Sailfish example application (on which I based my app) is initialized differently than a normal QML application (like those on the Qt Docs). So does the Sailfish example application (I mean the sailfishapplication.cpp and main.cpp parts) create a QDeclarativeEngine object?
 In other words: are those Sailfish namespace functions just a wrapper of the normal Qt initialization calls with special parameters for Sailfish apps? (it looks like that to me)
 

 Thanks in advance,
 

 Superpelican :)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sailfishos.org/pipermail/devel/attachments/20130504/9af2963f/attachment.html>


More information about the Devel mailing list