From 4bb801f6576c1abb96be940591f529f2996ad5d3 Mon Sep 17 00:00:00 2001 From: Ripose Date: Mon, 18 Oct 2021 14:15:14 -0700 Subject: [PATCH] strokelabel: prevents updates during text setting This could potentially causes graphically jank when updating a StrokeLabel, so there is no downside to wrapping setText in a portion of code that doesn't trigger updates. --- src/gui/widgets/common/strokelabel.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/widgets/common/strokelabel.cpp b/src/gui/widgets/common/strokelabel.cpp index 5f782fb1..2fc2949c 100644 --- a/src/gui/widgets/common/strokelabel.cpp +++ b/src/gui/widgets/common/strokelabel.cpp @@ -158,6 +158,9 @@ void StrokeLabel::setTextFont(const QFont &f) void StrokeLabel::setText(const QString &text) { + bool oldUpdatesEnabled = updatesEnabled(); + setUpdatesEnabled(false); + clearText(); QStringList subList = text.split('\n'); for (const QString &text : subList) @@ -194,6 +197,8 @@ void StrokeLabel::setText(const QString &text) cursor.mergeCharFormat(format); fitToContents(); + + setUpdatesEnabled(oldUpdatesEnabled); }