Skip to content

Commit

Permalink
strokelabel: prevents updates during text setting
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ripose-jp committed Oct 18, 2021
1 parent cb93730 commit 4bb801f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/gui/widgets/common/strokelabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -194,6 +197,8 @@ void StrokeLabel::setText(const QString &text)
cursor.mergeCharFormat(format);

fitToContents();

setUpdatesEnabled(oldUpdatesEnabled);
}


Expand Down

0 comments on commit 4bb801f

Please sign in to comment.