[Qt-interest] setParentItem() is hanging

André Somers andre at familiesomers.nl
Thu Feb 18 20:03:46 CET 2010


Warnings in the documentation don't magically show up in the code, or in the
compiler output. 
I would like to suggest that you show us what you try to do, with code,
because there are many users that successfully use QGraphicsView, add items
to scenes and parents, etc. I guess you're doing something wrong, but it's
hard to see what if you don't show it to us. 

Note that an "undefined behavior" warning in the documentation is to be
taken very seriously. You want to stay away from that. Really. Your program
might end up eating your babies, so to speak. 

André


-----Oorspronkelijk bericht-----
Van: trinathpujari [mailto:trinathpujari at tataelxsi.co.in] 
Verzonden: donderdag 18 februari 2010 12:41 
Aan: Andre Somers
CC: Qt-interest
Onderwerp: Re: [Qt-interest] setParentItem() is hanging

Hi Andre,

Thanks for your earliest reply....
            
             Actually we are now trying to replace 
QGraphicsItem::setParentItem( ) with QGraphicsScene::addItem(object) 
which will add the object directly to the scene but this is also not 
working and regarding your query about warning,

> Calling this function on an item that is an ancestor of parent have 
undefined behaviour.

No warning is coming in my code. If you know some alternative solution 
for the same please help me.

Regards
 Trinath



Andre Somers wrote:
> trinathpujari wrote:
>   
>> Hi All,
>>       
>>        When i am using setParentItem(), screen is hanging at the point 
>> of setParentItem() function call.
>>        Can anybody tell any other way of implementing the setParentItem( 
>> ) function.
>>
>> Thanking in Advance
>>
>> Regards
>>  Trinath
>>   
>>     
> It would have been helpful if you would have given slightly more 
> context, but I will assume for now that you are refering to 
> QGraphicsItem::setParentItem, as that seems to be the only function with 
> that name in Qt.
>
> Did you head the warning in the documentation?
>  > Calling this function on an item that is an ancestor of parent have 
> undefined behaviour.
>
> André
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>   








More information about the Qt-interest-old mailing list