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

Tomasz Siekierda sierdzio at gmail.com
Thu May 22 11:08:14 CEST 2014


On 22 May 2014 10:50, ElderOrb <elderorb at gmail.com> wrote:
> On Thu, 22 May 2014 09:23:57 +0300, Tomasz Siekierda <sierdzio at gmail.com>
> wrote:
>
>> On 22 May 2014 00:07, Alexander Ivash <elderorb at gmail.com> wrote:
>>> Use-case: Let's say I want to customize ComboBox's TextInput control
>>> which
>>> is not exposed via ComboBox API.
>>
>> There is some private API for that, but (unless something changed
>> recently) no official way to search by IDs. What I do in my code is
>> assign the objects an "objectName", then you can find objects by that
>> property (QObject::findChildren()).
>
> 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
problem, 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.



More information about the Interest mailing list