I'm just getting the QObject, because it is for some reason necessary to use it for it's context and as the parent of the C++ side components in order for them to show up properly in the viewport( Qt3d elements ). So I need to get the viewport by name and use it as a parent.
Thanks all, I didn't even try to set the objectName. I wouldn't have thought them to be separate identifiers. On Sat, Aug 6, 2011 at 7:21 AM, Johan Paul <[email protected]> wrote: > I don't know the specific use case why you want to return the QML > element to C++ side - but _usually_ it's better to interact with QML > from C++ with signals or property binding. I am pretty certain you can > do whatever you need to do with these utilities as well. It's just bad > design to interact directly with QML elements in C++. > > > -- > Johan > > > On Sat, Aug 6, 2011 at 1:32 PM, Tarantism <[email protected]> wrote: > > On Fri, 2011-08-05 at 21:44 -0500, Jeremy wrote: > >> So we give qml elements an 'id' name from within qml, but this name > >> appears not to become the objects 'objectName', and as a result, one > >> cannot seem to do recursive lookups for the objects by name using the > >> QObject->child methods and such. Is there an alternative? > > > > I set the objectName property in qml for elements that need to be looked > > up from C++. > > > > Item { > > id: lookupable > > objectName: "lookupable" > > } > > > > Clumsy but effective. I'd be interested to know of a better approach. > > > > > > _______________________________________________ > > Qt-qml mailing list > > [email protected] > > http://lists.qt.nokia.com/mailman/listinfo/qt-qml > > >
_______________________________________________ Qt-qml mailing list [email protected] http://lists.qt.nokia.com/mailman/listinfo/qt-qml
