mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix(UI): fix own status message not being properly displayed in tooltip
This causes a slight regression where own status can become quite huge when user sets e.g. 120 newlines between first and last character of the status message. Given that this fixes a problem with incorrect (broken) formatting of display of own status messages, the slight regression is insignificant. There is also a Qt bug involved that causes formatting to be broken if text contains "HTML" tags. https://bugreports.qt.io/browse/QTBUG-57477 Used workaround requires using additional HTML to preserve newlines even if HTML is a part of the status message. Related to #935.
This commit is contained in:
parent
335b408278
commit
dccef4d49f
|
@ -976,7 +976,11 @@ void Widget::setStatusMessage(const QString& statusMessage)
|
|||
else
|
||||
{
|
||||
ui->statusLabel->setText(statusMessage);
|
||||
ui->statusLabel->setToolTip(Qt::convertFromPlainText(statusMessage, Qt::WhiteSpaceNormal)); // for overlength messsages
|
||||
// escape HTML from tooltips and preserve newlines
|
||||
// TODO: move newspace preservance to a generic function
|
||||
ui->statusLabel->setToolTip("<p style='white-space:pre'>" +
|
||||
statusMessage.toHtmlEscaped() +
|
||||
"</p>");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user