diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2019-08-26 22:08:59 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2019-08-28 13:22:59 +0200 |
commit | 79bf1b7e348d186934b14c417859a48bf9b3a06c (patch) | |
tree | 22b51b050474855143b15ad2b77be223e842424e /src/widgets/kernel/qwidget.cpp | |
parent | 984df39c79e6129250fd0f8516fbfb2e28bcefd7 (diff) |
widgets: Mark widgets as needing flush during painting
Except for the case of syncing in response to an expose event,
where the platform asked us to flush a specific region, we
should strive to only flush parts that have been repainted.
And we should flush those parts to their nearest native child,
instead of unconditionally flushing the root/top level widget
as well.
By allowing drawWidget to schedule the flush we automatically
flush the minimal region, to the right widgets.
Change-Id: I73c143761d4a0da6991433b41dea0a0bc83a448a
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 45be132e59..cf5a81c204 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5313,9 +5313,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP } sourced->context = 0; - // Native widgets need to be marked dirty on screen so painting will be done in correct context - // Same check as in the no effects case below. - if (repaintManager && !asRoot && (q->internalWinId() || !q->nativeParentWidget()->isWindow())) + if (repaintManager) repaintManager->markNeedsFlush(q, rgn, offset); return; @@ -5422,8 +5420,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP sendPaintEvent(toBePainted); } - // Native widgets need to be marked dirty on screen so painting will be done in correct context - if (repaintManager && !asRoot && (q->internalWinId() || (q->nativeParentWidget() && !q->nativeParentWidget()->isWindow()))) + if (repaintManager) repaintManager->markNeedsFlush(q, toBePainted, offset); //restore |