PDA

View Full Version : Immediate paint



zgulser
30th October 2009, 07:58
Hi,

Is there any way to make an item to be drawn immediately?

wysota
30th October 2009, 09:30
Define "immediately", please.

zgulser
30th October 2009, 10:30
Ok...

I don't want the view schedules the paint event for the item when I call update(...) method of the item. For example, repaint in widget.

wysota
30th October 2009, 12:30
Use QGraphicsScene::render() to render part of the scene to an arbitrary paint device. If you want repaint(), just call repaint() on the view's viewport. Other than that you are left with update().

zgulser
30th October 2009, 12:46
these are not what I'm looking for. I just want to call item::repaint or something and see the change on the screen.

wysota
30th October 2009, 13:31
And why is update() not filling the job?

zgulser
30th October 2009, 13:52
because it doesn't respond at the time I call it. As you already know, view schedules such arbitrary update calls. When you are not on the item's bounding rectangle or something, let's say you are zooming via a button not exist on the view/scene for example, it doesn't call the paint method immediately even if you call update of an item.

squidge
30th October 2009, 14:35
That correct, if you update or invalidate a section of the screen, that is simply a notification that is posted to a queue. The repaint will be done when that message is retrieved by the event system which is normally at application idle. If you want it to process those messages more quickly, you can call processEvents if you really need to, but if its required, it normally points to a badly designed app.

zgulser
30th October 2009, 14:45
Yes. But I don't get the point. I mean if there exists a method for the widgets then why items doesn't have one?

squidge
30th October 2009, 18:37
Why does this cause a problem for you? What are you trying to do exactly?

wysota
30th October 2009, 18:41
Yes. But I don't get the point. I mean if there exists a method for the widgets then why items doesn't have one?

Why would they need one? If you want the view of the items repainted, then call repaint() on the view. Items have nothing to do with this. Calling update() on items has nothing to do with repainting the views, that's just a potential side effect of the call. The item only informs the scene it has been changed.

suneyes
15th March 2010, 07:34
Items are more the model part, widgets are more the view part. You have to paint on view always. For eg : for a treeView, try calling viewport's repaint(). If u have treeWidget, try calling its repaint().
Also if you could provide some more information as to what exactly you wish to achieve.. :)