<div dir="ltr"><div><div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">for properties system you should use Q_PROPERTY macro inside your class.</blockquote><div> </div><div>Since i have to access properties of a class declared inside another class i find using the macro Q_PROPERTY a little confusing.<br></div> </div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">Actually, I think you're creating a new
instance of the FirstPage.qml component using this code. But,
Sailfish should have already created its own instance of that page
when it started up.<br>
<br>
You might instead try retrieving a view of the Sailfish instance
and going from there, something like this:<br>
<br>
QQuickView *view = SailfishApp::createView();<br>
QObject *object = view->rootObject();<span class=""></span><br><span class="">
QObject *label = object->findChild<QObject *>("label");</span><br><span class="">
</span><br><span class=""></span><span class="HOEnZb"><font color="#888888">
--John</font></span><br></blockquote><br></div>I tried this, it compiles, after including <sailfishapp.h> and <QQuickItem>, but now there's no output, as it can't find the proper object or the SailfishApp::createView() creates a new, empty view<br><br>The code is this:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"> ...</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"> QQuickView *view = SailfishApp::createView();<br> QObject *object = view->rootObject();<br> QObject *label = object->findChild<QObject*>("label");<br> QQmlProperty property(label, "text");<br><br> cout << "Read before: " << property.read().toString() << endl;<br><br> if (label) {<br> cout << "true";<br> property.write(<a href="http://active.name">active.name</a>);<br> } else<br> cout << "false" << endl;<br><br> cout << "Read after: " << property.read().toString() << endl;<br><br> fetchMonsterDone();<br></blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div> ... <br></div></blockquote><div><br></div><div>the output is:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
<style type="text/css">
p, li { white-space: pre-wrap; }</style>
<style type="text/css">
p, li { white-space: pre-wrap; }</style>
<style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="font-family:'Monospace';font-size:9pt;color:#3c3c3c">Read before: </span></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="font-family:'Monospace';font-size:9pt;color:#3c3c3c">false</span></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="font-family:'Monospace';font-size:9pt;color:#3c3c3c">Read after: </span></p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="font-family:'Monospace';font-size:9pt;color:#be1414">[D] onFetchMonsterDone:51 - Fetch done</span></p></blockquote></div><style type="text/css"> p, li { white-space: pre-wrap;
</style><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
</blockquote></div>