Jump to content

[SOLVED] Finding a widget by name


photo

Recommended Posts

I have a situation where I want to find some specific widgets within a window, but I don't want to export them as the number of widgets I need to find will vary (based on some external configuration). My first thought was to name the widget, but not export it, then just iterate through the widget tree looking for that name. Unfortunately I was stopped in my tracks when I found that the Widget class doesn't have a getName function. Then I spotted the getData function but couldn't find any way to specify that value in the ui file.

 

Any suggestions as to where else I could store a (hidden) string in a ui file, that I can then read via script?

Seems like I really should be using a getName function. Why on earth is that not already there?

Link to comment

That is exactly what I was looking for. Thanx. I guess I was looking too deep because I automatically think of name as being a property of the widget. Needed to look at the class holding the widgets, not the widgets themselves.

Link to comment
×
×
  • Create New...