Hi Jukka,

there are some possible ways. You could write just another function, you
are calling from QML like getMyInformation() which is returning your data
as QVariant, that you can use in QML.


You can also catch C++ signals with QMLs Connections element. So that your
C++ logic emit a signal with the data and it's catched and used in QML.


Or you can use QProperies, so that some attributes of your class can be
accessed from QML - good point here is, it's updating the QML side when the
values changed in C++ automatically.


All variants could be used if you make your object accessable via
setContextProperty().


Hope that helps a bit. ;)



Gabriel

--



Von meinem Nokia N9 gesendet



Jukka Heikkilä schrieb am 21.12.13 11:05:
Hi,

I have successfully learned how to call C++ method from QML. I would
like to see a practical example how to call QML function from C++
method. All examples and instructions which I have found from web have
been such kind of codes where all is done from main loop.

I'm not sure is my approach right, but in my program I would first
like to call C++ method from QML and C++ function will retrive data.
After the data retrive is ready the C++ method will call other C++
method which will update the screen (e.g. multiple labels).

I would be very happy to get help with this problem and I think that
the begginners will also fighting with this kind of problems.

Happy Holidays!

Kind Regards,
Jukka Heikkilä
@Juukks
_______________________________________________
SailfishOS.org Devel mailing list
_______________________________________________
SailfishOS.org Devel mailing list

Reply via email to