[Qt-interest] Fw: QGraphicsItem::scene() returns 0x0

Mihail Naydenov mlists at ymail.com
Wed Apr 20 11:45:41 CEST 2011


As said, you might be calling it *in the wrong time* - before item is added to 
the scene.


>
>From: Wathek LOUED <wathek at gmail.com>
>To: Mihail Naydenov <mlists at ymail.com>
>Cc: qt-interest at trolltech.com
>Sent: Wed, April 20, 2011 12:38:07 PM
>Subject: Re: [Qt-interest] Fw: QGraphicsItem::scene() returns 0x0
>
>I'm calling scene from the Item it self I cannot see what's wrong 
>
>
>On Wed, Apr 20, 2011 at 11:17 AM, Mihail Naydenov <mlists at ymail.com> wrote:
>
>
>>
>>
>>>
>>>----- Forwarded Message ----
>>>From: Mihail Naydenov <mlists at ymail.com>
>>>To: Wathek LOUED <wathek at gmail.com>
>>>Sent: Wed, April 20, 2011 12:16:44 PM
>>>Subject: Re: [Qt-interest] QGraphicsItem::scene() returns 0x0
>>>
>>>
>>>Make sure you dont scene() from the item's ctor (explicitly or indirectly).
>>>
>>>You can reiml itemChange and listen for scene change, then you be certain the 
>>>item is in scene already. 
>>>
>>>
>>>MihailNaydenov
>>>
>>>
>>>
>>>>
>>>>From: Wathek LOUED <wathek at gmail.com>
>>>>To: qt-interest <qt-interest at qt.nokia.com>
>>>>Sent: Wed, April 20, 2011 2:22:59 AM
>>>>Subject: [Qt-interest] QGraphicsItem::scene()  returns 0x0
>>>>
>>>>
>>>>Hi everybody,
>>>>
>>>>
>>>>I got a problem when I call QGraphicsItem::scene() function it returns 0x0 
>>>>however it should returns the address of the scene of the QGraphicsItem. It's 
>>>>strange cause I've used QGraphicsScene::addItem function to add my QGraphicsItem 
>>>>and I can see the item in my scene but when I try to get the scene address it 
>>>>returns 0x0.
>>>>
>>>>
>>>>I need to get that to be able to get the scene dimensions. I cannot see an other 
>>>>way to do it.
>>>>
>>>>
>>>>Thank you so much
>>>>
>>>>
>>>>Sincerely
>>>>Wathek
>>_______________________________________________
>>Qt-interest mailing list
>>Qt-interest at qt.nokia.com
>>http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110420/6c20dfdf/attachment.html 


More information about the Qt-interest-old mailing list