1
0
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:
Zetok Zalbavar 2016-12-05 20:24:36 +00:00
parent 335b408278
commit dccef4d49f
No known key found for this signature in database
GPG Key ID: C953D3880212068A

View File

@ -976,7 +976,11 @@ void Widget::setStatusMessage(const QString& statusMessage)
else else
{ {
ui->statusLabel->setText(statusMessage); 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>");
} }
} }