From 37433c1897ca467f5387545ac464675981955b8b Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 12 Jun 2023 10:23:42 +0200 Subject: [PATCH] Editor: do not set the viewport margins if they have not changed Change-Id: I01adabc52e47e8a47aff0f5dc2b580066e51307c Reviewed-by: Reviewed-by: Christian Stenger --- src/plugins/texteditor/texteditor.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 4592980540e..544a0f97c3b 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -5168,10 +5168,13 @@ void TextEditorWidgetPrivate::slotUpdateExtraAreaWidth(std::optional width) { if (!width.has_value()) width = q->extraAreaWidth(); + QMargins margins; if (q->isLeftToRight()) - q->setViewportMargins(*width, 0, 0, 0); + margins = QMargins(*width, 0, 0, 0); else - q->setViewportMargins(0, 0, *width, 0); + margins = QMargins(0, 0, *width, 0); + if (margins != q->viewportMargins()) + q->setViewportMargins(margins); } struct Internal::ExtraAreaPaintEventData