Qt: Escape HTML when setting ElidedLabel text

ElidedLabels use Qt's rich text internally, but we need to make sure the
text we're passed via setText() is plain.

Fixes #18774
This commit is contained in:
Gerald Combs 2022-12-31 12:22:00 -08:00 committed by AndersBroman
parent 1c24e49c67
commit d9adb6f712
2 changed files with 5 additions and 1 deletions

View File

@ -74,6 +74,6 @@ void ElidedLabel::clear()
void ElidedLabel::setText(const QString &text)
{
full_text_ = text;
full_text_ = text.toHtmlEscaped();
updateText();
}

View File

@ -46,6 +46,10 @@ public slots:
* @brief clear Clear the label.
*/
void clear();
/**
* @brief setText Set the label's plain text.
* @param text The text to set. HTML will be escaped.
*/
void setText(const QString &text);
};