Help Text: wrap the text

But add a line of spaces to make sure it is wide enough otherwise the
default messagebox size is way too small.

Issue #6644
This commit is contained in:
Olivier Goffart 2018-07-12 18:44:01 +02:00 committed by Markus Goetz
parent 916343d7c2
commit ff09ebd47a

View File

@ -540,20 +540,12 @@ void Application::parseOptions(const QStringList &options)
// Helpers for displaying messages. Note that there is no console on Windows.
#ifdef Q_OS_WIN
// Format as <pre> HTML
static inline void toHtml(QString &t)
static void displayHelpText(const QString &t) // No console on Windows.
{
t.replace(QLatin1Char('&'), QLatin1String("&amp;"));
t.replace(QLatin1Char('<'), QLatin1String("&lt;"));
t.replace(QLatin1Char('>'), QLatin1String("&gt;"));
t.insert(0, QLatin1String("<html><pre>"));
t.append(QLatin1String("</pre></html>"));
}
static void displayHelpText(QString t) // No console on Windows.
{
toHtml(t);
QMessageBox::information(0, Theme::instance()->appNameGUI(), t);
QString spaces(80, ' '); // Add a line of non-wrapped space to make the messagebox wide enough.
QString text = QLatin1String("<qt><pre style='white-space:pre-wrap'>")
+ t.toHtmlEscaped() + QLatin1String("</pre><pre>") + spaces + QLatin1String("</pre></qt>");
QMessageBox::information(0, Theme::instance()->appNameGUI(), text);
}
#else