
Originally Posted by
wysota
Ok, but how does it differ in your case? Qt calls update() upon resize as well...
yes, It differ in my case at least when I create my widget as a top level widget. look at the following code(from qapplication_win.cpp) :
if (d_func()->paintOnScreen()) {
if (testAttribute(Qt::WA_StaticContents))
updateRegion
-= QRect(0,
0, oldSize.
width(), oldSize.
height());
d_func()->syncBackingStore(updateRegion);
} else {
d_func()->syncBackingStore();
}
QResizeEvent e(newSize, oldSize);
QApplication::sendSpontaneousEvent(this, &e);
if (d_func()->paintOnScreen()) {
QRegion updateRegion(rect());
if (testAttribute(Qt::WA_StaticContents))
updateRegion -= QRect(0, 0, oldSize.width(), oldSize.height());
d_func()->syncBackingStore(updateRegion);
} else {
d_func()->syncBackingStore();
}
To copy to clipboard, switch view to plain text mode
Qt will just send resizeEvent to my widget and I don't see any of the event handler will call update(). In fact it is done in d_func()->syncBackingStore(); this function will sync the backing store of the top level widget, in my case, it will draw the newly exposed area of the widget immediately(in syncBackingStore() Qt will always deem the newly exposed area as dirty even I have called repaint() in my resizeEvent handler). So if I call repaint() in my resizeEvent handler, the newly exposed area will be redrawn twice.
Bookmarks