PDA

View Full Version : QGraphicsItem::paint() triggered only once



Rogagol
11th February 2016, 00:22
Hi, i have class inherit frome QGraphicsItem, and problem is that paint function triggered only once, after this one call, i cant repaint this item even if i try use update funktion, or prepareGeometryChange. Item can be repainted only when i resize program window. I use qDebug so i'm sure that function is not triggered, and in first time, and when i resized window paint work correctly.
Any suggestion?

Rogagol
12th February 2016, 00:50
Hi guys,
i find cause of my problem. I used eventfilter in QObject which "control" QGraphicsItem objects, and i dont put in end of eventfilter function this: return QObject::eventFilter(obj, event); so i think that all of events were "taken" by me, and cant work correctly.
Next time i put to thread my code, maybe then somebody see error like in this case.
Thread can be close. Thx

d_stranz
12th February 2016, 00:50
Is the item visible? (QGraphicsItem::isVisible() returns true). Is paint() called when you change the visibility (setVisible( false ), followed by setVisible( true ))? Do you call update() on the scene or on the item itself?

Edit - our posts crossed. You are right - if your event filter eats all the events, then of course nothing can happen.