widgets: Clarify QWidgetRepaintManager::sync of specific widget

Change-Id: Ifa2a8245decfcb2b36c1952a39ec60b7eeca6e43
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Tor Arne Vestbø 2019-08-26 14:57:44 +02:00
parent af686f5aef
commit 25026defdc

View File

@ -707,9 +707,9 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget)
/*! /*!
Synchronizes the \a exposedRegion of the \a exposedWidget with the backing store. Synchronizes the \a exposedRegion of the \a exposedWidget with the backing store.
If there's nothing to repaint, the area is flushed and painting does not occur; If there are dirty widgets, including but not limited to the \a exposedWidget,
otherwise the area is marked as dirty on screen and will be flushed right after these will be repainted first. The backingstore is then flushed to the screen,
we are done with all painting. regardless of whether or not there were any repaints.
*/ */
void QWidgetRepaintManager::sync(QWidget *exposedWidget, const QRegion &exposedRegion) void QWidgetRepaintManager::sync(QWidget *exposedWidget, const QRegion &exposedRegion)
{ {
@ -730,6 +730,9 @@ void QWidgetRepaintManager::sync(QWidget *exposedWidget, const QRegion &exposedR
return; return;
} }
// As requests to sync a specific widget typically comes from an expose event
// we can't rely solely on our own dirty tracking to decide what to flush, and
// need to respect the platform's request to at least flush the entire widget,
QPoint offset = exposedWidget != tlw ? exposedWidget->mapTo(tlw, QPoint()) : QPoint(); QPoint offset = exposedWidget != tlw ? exposedWidget->mapTo(tlw, QPoint()) : QPoint();
markNeedsFlush(exposedWidget, exposedRegion, offset); markNeedsFlush(exposedWidget, exposedRegion, offset);