> > for properties system you should use Q_PROPERTY macro inside your class.
Since i have to access properties of a class declared inside another class i find using the macro Q_PROPERTY a little confusing. > 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. > > You might instead try retrieving a view of the Sailfish instance and going > from there, something like this: > > QQuickView *view = SailfishApp::createView(); > QObject *object = view->rootObject(); > QObject *label = object->findChild<QObject *>("label"); > > --John > 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 The code is this: > ... QQuickView *view = SailfishApp::createView(); > QObject *object = view->rootObject(); > QObject *label = object->findChild<QObject*>("label"); > QQmlProperty property(label, "text"); > > cout << "Read before: " << property.read().toString() << endl; > > if (label) { > cout << "true"; > property.write(active.name); > } else > cout << "false" << endl; > > cout << "Read after: " << property.read().toString() << endl; > > fetchMonsterDone(); > ... > the output is: > Read before: > > false > > Read after: > > [D] onFetchMonsterDone:51 - Fetch done >
_______________________________________________ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org