[Interest] Is there any way to find QML object by id?

Tony Rietwyk tony at rightsoft.com.au
Thu May 22 12:01:51 CEST 2014

> > Thats exactly what I would also do if it would be my component, but
> > unfortunately I don't have an access to TextInput { id: input } which
> > is inside the ComboBox.
> But you are able to assign the ID or is it built-in? I don't get the
> although I have not used the ComboBox, so maybe that is the reason. All
> (most :-P) QML elements derive from QtObject, so you can assign
> "objectName" easily to them.

Hi Tomasz, 

For the specific use case, I think the OP is asking for the QML equivalent
of QComboBox.lineEdit().   

In C++, by inspecting the Qt sources, you can often code for a specific
internal private objectName or class type to use with QObject.findChildren,
or in your css, since that QObject information is public anyway.  Needless
to say, this is just a version specific HACK and should be flagged and
commented as such! 

Alexander, do you have another use case in mind?  It might clarify your
requirement.  (I haven't played with QML yet but I thought all QObject info
is exposed to javascript and the components anyway - isn't that how the
linkage is achieved?)



More information about the Interest mailing list