JavierAcost
JavierAcost

Reputation: 65

Qt widget stops receiving paintevents

I have been doing an implementation of Conways game of life in PySide [source]. So far it works good until a point in which, under certain conditions I havent figured out yet, the QGraphicsView i use to display the grid (which consists of several QGraphicsRectItems on a QGraphicsScene) suddenly stops being painted continuously. The rest of the window remains responsive and the game thread keeps running and signaling for the ui to update the current generation number. It is only when the window gains focus that the graphicsView updates for about a second and then freezes again.

I find this behavior particularly strange given that i dont override paintEvent, nor call repaint/update methods at all, but what the game thread does is to update every RectItem's brush color according to the status it should have every generation.

Any ideas on what could be causing this?

btw this is on Kubuntu 14.04.3 / KWin 4.11.11 / Qt 4.8.6

Upvotes: 1

Views: 126

Answers (1)

JavierAcost
JavierAcost

Reputation: 65

Managed to solved it myself! In case someone runs into same issue, all that i needed to do was to schedule an update by calling the update method of the qgraphicsscene every generation (i.e. after operating on the graphicRects from the game thread).

I assume the strange behavior was probably the result of trying to save cpu load, since for the gui thread there was no work to be done!

Upvotes: 1

Related Questions