[Qt-interest] Multiple Objects all having the Same name

Bo Thorsen bo at fioniasoftware.dk
Wed Feb 15 08:41:48 CET 2012


Den 15-02-2012 08:37, Andreas Pakulat skrev:
> On 15.02.12 07:33:22, Bo Thorsen wrote:
>> Den 14-02-2012 21:30, Michael Jackson skrev:
>>> Is it a "Bad Idea" to have multiple objects all have the same Object
>>> Name? I am writing some code and trying to solve a problem where the
>>> easiest solution would be to have some of my GUI widgets all have the
>>> same Object Name. But I am thinking this is a "really bad" idea.
>>
>> It is probably a bad idea, because
> [...]
>> - Tools like Squish won't work
>
> Thats wrong at least for Squish. While Squish does use the objectName
> for identification purposes its not the only property of an object it
> uses and hence its not necessarily going to fail in the case of two
> objects having the same name. There are cases of course where the wrong
> object could be found if not only the object name but also all other
> properties and all containers are the same (i.e. the two widgets are in
> the same container widget and have the same properties - including the
> type).

No, it's not wrong. If you have unique object names, Squish will work 
for sure, even when you rearrange the object tree, change properties, etc.

If you don't have unique object names, it might work. I consider "might 
work" useless.

Bo Thorsen,
Fionia Software.

-- 

Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk



More information about the Qt-interest-old mailing list