Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, February 2007
QGraphicsView and QGraphicsItem


Message 1 in thread

Hi,

i am still testing about QGraphicsView and QGraphicsItem.
Now i reimplemented the "Colliding Mice Example", but i used a  
QMainWindow and set
the QGraphicsView as central widget. This does well - as expected.

Now i tried to attach my broadcast implementation. A turned on only 1  
sender so that every
second an event should occur. Within the callback of the broadcast  
the visibility of the associated mouse should be toogled.

After starting the application everything works fine. But when the  
first event is recieved the whole
repaint processes stops/freezes - of each mouse. I cannot explain why.

Has somebody any suggestions how to debug this?


Thanks, Martin

--
 [ signature omitted ] 

Message 2 in thread

On Monday 05 February 2007 13:59, Martin Buchleitner wrote:
> Hi,
>
> i am still testing about QGraphicsView and QGraphicsItem.

<snip>

I have a very similar problem to the one you mentioned in a previous mail a 
few days ago (don't have my archive of mails here so I can't reply to the 
correct mail). QGraphicsView doesn't repaint correctly when items are "added 
in code". I dynamically add some QGraphicsPixmapItem subclasses and they 
don't seem to get fully repainted until the whole window is hidden and shown 
or until I do something similar to:

	QGraphicsScene *scene = ...;
	scene->update (scene->sceneRect());

My new pixmap items are usually half drawn or not visible at all. Just a 
simple scene->update() doesn't do it, no visual difference, a full update of 
the whole scene is needed. Calling update() shouldn't really be needed at all 
according to the docs, it should "just happen".

As my app doesn't repaint too often it's still feasible to repaint all, but I 
fear the day when I have hundreds of items on the scene/screen at one, as I 
then think I'll have made myself a slideshow. :)

-- 
 [ signature omitted ] 

Message 3 in thread

Jan Ekholm schrieb:
> On Monday 05 February 2007 13:59, Martin Buchleitner wrote:
>   
>> Hi,
>>
>> i am still testing about QGraphicsView and QGraphicsItem.
>>     
>
> <snip>
>
> [...] QGraphicsView doesn't repaint correctly when items are "added 
> in code". I dynamically add some QGraphicsPixmapItem subclasses and they 
> don't seem to get fully repainted until the whole window is hidden and shown 
> or until I do something similar to:
>
> 	QGraphicsScene *scene = ...;
> 	scene->update (scene->sceneRect());
>
> My new pixmap items are usually half drawn or not visible at all. 
> [..]
>   
Hi,
I'm not sure if this drifts away from the original posters question, but 
al least it might be of interest for
Jan Ekholm:
Did you check the itemChange() method?
http://doc.trolltech.com/4.2/qgraphicsitem.html#itemChange
The enum
http://doc.trolltech.com/4.2/qgraphicsitem.html#GraphicsItemChange-enum
describes various changes, one is "QGraphicsItem::ItemChildAddedChange", 
so maybe this
helps without calling update on the whole sceneRect.
Might be worth a try...

Regards,
Daniel

-- 
 [ signature omitted ] 

Message 4 in thread

Daniel Walz schrieb:
> Jan Ekholm schrieb:
>> On Monday 05 February 2007 13:59, Martin Buchleitner wrote:
>>  
>>> Hi,
>>>
>>> i am still testing about QGraphicsView and QGraphicsItem.
>>>     
>>
>> <snip>
>>
>> [...] QGraphicsView doesn't repaint correctly when items are "added 
>> in code". I dynamically add some QGraphicsPixmapItem subclasses and 
>> they don't seem to get fully repainted until the whole window is 
>> hidden and shown or until I do something similar to:
>>
>>     QGraphicsScene *scene = ...;
>>     scene->update (scene->sceneRect());
>>
>> My new pixmap items are usually half drawn or not visible at all. [..]
>>   
> Hi,
> I'm not sure if this drifts away from the original posters question, 
> but al least it might be of interest for
> Jan Ekholm:
> Did you check the itemChange() method?
> http://doc.trolltech.com/4.2/qgraphicsitem.html#itemChange
> The enum
> http://doc.trolltech.com/4.2/qgraphicsitem.html#GraphicsItemChange-enum
> describes various changes, one is 
> "QGraphicsItem::ItemChildAddedChange", so maybe this
> helps without calling update on the whole sceneRect.
> Might be worth a try...
>
> Regards,
> Daniel
>
Sorry, forget my comment, reading it again I noticed, that this is the 
other way round...
Just to get notifies, not to send them.
I was looking for something similar to prepareGeometryChange()
http://doc.trolltech.com/4.2/qgraphicsitem.html#prepareGeometryChange

Cheers,
Daniel

-- 
 [ signature omitted ] 

Message 5 in thread

On Feb 5, 2007, at 12:59 PM, Martin Buchleitner wrote:

> Hi,
>
> i am still testing about QGraphicsView and QGraphicsItem.
> Now i reimplemented the "Colliding Mice Example", but i used a  
> QMainWindow and set
> the QGraphicsView as central widget. This does well - as expected.
>
> Now i tried to attach my broadcast implementation. A turned on only  
> 1 sender so that every
> second an event should occur. Within the callback of the broadcast  
> the visibility of the associated mouse should be toogled.
>
> After starting the application everything works fine. But when the  
> first event is recieved the whole
> repaint processes stops/freezes - of each mouse. I cannot explain why.

Now i reimplemented the udp multicast using a regular udp socket  
which listens on a specific port.
This implementation is running in a QThread::run() method.

But the result is the same as with the former udp implementation :-/


Martin

--
 [ signature omitted ]