<div dir="ltr">it's not C++, it's JavaScipt function, you can use it inside QML<br><br>onClicked: {<br>                 <br>                 ekpu=parseFloat(ekField.text)<br>                 <br><p style="margin:0px;text-indent:0px"><span style="font-family:"Monospace";font-size:9pt;color:rgb(170,0,0)"><br></span><span style="font-family:"Monospace";font-size:9pt;color:rgb(170,0,0)"></span></p>                 pageStack.push(Qt.resolvedUrl("SecondPage.qml"))<br>             }<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, May 22, 2016 at 5:17 AM, Peter Kovacs <span dir="ltr"><<a href="mailto:leginee@gmail.com" target="_blank">leginee@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<span class=""><div><br></div><div><span style="font-size:12.8px"># gives: QString not declared even if there is #include <QString> in main.cpp</span><br></div></span><div><span style="font-size:12.8px">that is not sufficient!</span></div><div><span style="font-size:12.8px">Quoted from: <a href="http://stackoverflow.com/questions/9500280/access-c-function-from-qml" target="_blank">http://stackoverflow.com/questions/9500280/access-c-function-from-qml</a></span></div><div><table style="margin:0px;padding:0px;border:0px;font-size:13px;border-spacing:0px;border-collapse:collapse;color:rgb(36,39,41);font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;line-height:16.9px"><tbody style="margin:0px;padding:0px;border:0px"><tr style="margin:0px;padding:0px;border:0px"><td style="padding:0px 15px 0px 0px;border:0px;vertical-align:top"><br></td><td style="padding:0px;border:0px;vertical-align:top"><div style="margin:0px 0px 5px;padding:0px;border:0px;width:660px;word-wrap:break-word;line-height:1.3"><p style="margin:0px 0px 1em;padding:0px;border:0px;clear:both"><font size="2">For any C++ code to be called from QML, it must reside inside a <code style="margin:0px;padding:1px 5px;border:0px;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;white-space:pre-wrap;background-color:rgb(239,240,241)">QObject</code>.</font></p></div></td></tr></tbody></table></div><div></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">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.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">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.</span></div><div><span style="font-size:12.8px">Looks nicer in my eyes if you have a class that handles this properly.</span></div><div><br></div><div>All the Best</div><span class="HOEnZb"><font color="#888888"><div>Peter</div><div><br></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2016-05-21 11:06 GMT+02:00 Caliste Damien <span dir="ltr"><<a href="mailto:dcaliste@free.fr" target="_blank">dcaliste@free.fr</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<span><br>
Le samedi 21 mai 2016, mariusz sapinski a écrit :<br>
>    I'm trying to convert text from a text field:<br>
</span><span>> to double (property double ekpu)<br>
</span>You may want to use parseFloat().<br>
<br>
<a href="http://www.w3schools.com/jsref/jsref_parseFloat.asp" rel="noreferrer" target="_blank">http://www.w3schools.com/jsref/jsref_parseFloat.asp</a><br>
<br>
Damien.<br>
_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org" target="_blank">devel-unsubscribe@lists.sailfishos.org</a></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
To unsubscribe, please send a mail to <a href="mailto:devel-unsubscribe@lists.sailfishos.org">devel-unsubscribe@lists.sailfishos.org</a><br></blockquote></div><br></div>