[SailfishDevel] string to double in QML?
leginee at gmail.com
Sun May 22 03:17:58 UTC 2016
# gives: QString not declared even if there is #include <QString> in
that is not sufficient!
For any C++ code to be called from QML, it must reside inside a QObject.
So best is to write your own class that holds the data, then have a method
that sets the double value and does the cast to double.
I personally would not do the conversion in the QML part, because the QML
main task is to represent something. The tast of your data class is to care
about the data.
Looks nicer in my eyes if you have a class that handles this properly.
All the Best
2016-05-21 11:06 GMT+02:00 Caliste Damien <dcaliste at free.fr>:
> Le samedi 21 mai 2016, mariusz sapinski a écrit :
> > I'm trying to convert text from a text field:
> > to double (property double ekpu)
> You may want to use parseFloat().
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscribe at lists.sailfishos.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Devel