Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(UI): fix own status message not being properly displayed in tooltip
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zetok committed Dec 30, 2016
1 parent 335b408 commit dccef4d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/widget/widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>");
}
}

Expand Down

0 comments on commit dccef4d

Please sign in to comment.