PDA

View Full Version : QGraphicsView rendering issue



guilugi
27th March 2007, 15:52
Hi !

I'm working on a QGraphicsView widget, meant to display interactive graphical items, that I can move / reshape / delete as I want.

It works perfectly fine, the QGraphicsView framework is really good :)

In order to filter this view with a color or a texture, I wanted to set a custom foreground brush to the scene, with this line :
my_view->setForegroundBrush(QColor(255, 255, 255, 127));

It applies well to the whole view, but when I move any item, I have some painting problems, described by the snapshot in attachment.

I checked all the render hints, the painting methods for items, but I can't point the mistake.

Any idea ?

Thanks,
Guilugi.

jpn
27th March 2007, 20:29
Are you using the built-in QGraphicsItem::ItemIsMovable flag for moving the items?

Bitto
27th March 2007, 21:21
Please show us some code, guilugi. If it's a bug in Qt, it should be possible to nail down.

aamer4yu
28th March 2007, 06:26
Check the bounding rectangles of the items... I guess your problem might be related to it.

Also for debugging purposes, I usually draw the boundingRect in paint function. It helps u to identify the boundaries... and mistakes too :D

Hope this helps :)

guilugi
28th March 2007, 10:01
Ok !
Thanks for these answers guys ;)

Jpn : yes, I'm using the flag ItemIsMovable.

Bitto : I'm currently making a small simple example, I'll post it quickly here.

Aamer4yu : I use the predefined Qt items to render text, shapes, and images, I didn't subclassed one of them at all.
I only subclassed my QGraphicScene class in order to draw background manually...

I'll try to reimplement one of them to see if it helps ;-)

Thanks again,
Guilugi.

guilugi
28th March 2007, 10:40
Here comes the sample of code !

There's a button below the graphics view, enabling / disabling the foreground filter.

Guilugi.

jpn
29th March 2007, 13:40
Nice sample. ;) I can reproduce the problem with both 4.2.3 and 4.3.0beta.

guilugi
2nd April 2007, 15:49
Ok, thanks for your feedback jpn !

Have you already posted this bug on Task Tracker, or may I do it ? :)

Guilugi.

jpn
2nd April 2007, 15:56
Have you already posted this bug on Task Tracker, or may I do it ? :)
No, actually I haven't. I was kindly waiting for comments from Andreas aka Bitto. :) But sure, go ahead and report the issue.

guilugi
6th April 2007, 10:09
Ok, bug confirmed, here are the tracker details :

Fix scheduled for Qt 4.3.0

http://www.trolltech.com/developer/task-tracker/index_html?method=entry&id=157400