OK, case closed, thanks to all who replied. FYI, the problem was QGLWidget. Replacing it with QWidget not only solved the problem but also made the redrawing much faster. The program also starts faster and is a bit smaller. All win, no lose.