Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix QVTKWidget refresh on resize problem on Windows
When resizing a toplevel QVTKWidget, only the newly exposed part is refreshed, not the entire viewport. Qt::WA_PaintOnScreen is only supported on X11: http://doc.qt.nokia.com/4.7/qt.html#WidgetAttribute-enum For all purpose widgets, it is ok to leave the flag Qt::WA_PaintOnScreen for other platforms, because the flag is ignored. See QWidget::setAttribute(), there is a special to ignore the flag on Windows. However, QVTKWidget uses a custom QPaintEngine, so the hack done in QWidget::paintEngine() on Windows is not applied and doesn't ignore the flag then: Here is an extract from qwidget_win.cpp (in QWidget::paintEngine) // We set this bit which is checked in setAttribute for // Qt::WA_PaintOnScreen. We do this to allow these two scenarios: // // 1. Users accidentally set Qt::WA_PaintOnScreen on X and port to // windows which would mean suddenly their widgets stop working. // // 2. Users set paint on screen and subclass paintEngine() to // return 0, in which case we have a "hole" in the backingstore // allowing use of GDI or DirectX directly. // // 1 is WRONG, but to minimize silent failures, we have set this // bit to ignore the setAttribute call. 2. needs to be // supported because its our only means of embeddeding native // graphics stuff. const_cast<QWidgetPrivate *>(d_func())->noPaintOnScreen = 1; Please note that QVTKWidget2 (QGLWidget) sets the flag Qt::WA_PaintOnScreen all platforms. However, various hacks in Qt GUI (qwidget.cpp, qwidget_win.cpp, qbackingstore.cpp...) make QGLWidget works fine on Windows. Change-Id: Ia5d8256152885932ab500a761d619f673f43956f
- Loading branch information