Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
PyQt application hangs
ssal last edited by
PyQt application hangs on QGraphicsView paintEvent. Since this application was written in Qt3, most of the drawing is done outside the paintEvent.
QGraphicsView is inherited and within the update method of QGraphicsView, the application always create a new instance of QGraphicsScene ( since the contents change frequently ) and adds the QGraphicsLineItem, QGraphicsRectItem and QGraphicsPolygonItem to QGraphicsScene. And then paints the objects when paintEvent is called. Most of the time application works good. But sometimes it hangs and I have to kill the application. Since I am not able to generate a pattern that make application hang I cannot provide sample code that will reproduce this issue.
The application hangs only in a particular situation though :
In a method :
I create QProgressDialog instance
In a loop for each query
set new value for QProgressDialog
Go fetch data for that query and save it in the application.
once the loop is completed I emit datachanged signal.
Although in the logs I see that the progress.close() being called, adding the chart items to the QGraphicsScene is called. But progress dialog remains on the screen and no chart it drawn since application hangs at QGraphicsView paintEvent.
Could be related to QTimer ? ( There are QTimer running with 100ms timeout ... while fetching the data )
Could it be because I am painting outside paintEvent ?
Could it be because I am calling QGraphicsScene.update in QGraphicsView.update method ?
Or Could it be because I might be drawing outside QGraphicsScene bounding rect ?
There is no recursion in my application.
Can someone please advice How/where should I look into this issue.
danilocesar last edited by
[quote author="ssal" date="1303155063"]the application always create a new instance of QGraphicsScene ( since the contents change frequently ) [/quote]
I don't believe it's really necessary.
Did you try PySide?