mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 23:35:33 +08:00
Ref T365, use not-wrapping tooltips
This commit is contained in:
@@ -9,8 +9,10 @@
|
||||
|
||||
#include "settingssimulatorbasicscomponent.h"
|
||||
#include "ui_settingssimulatorbasicscomponent.h"
|
||||
|
||||
#include "blackmisc/simulation/xplane/xplaneutil.h"
|
||||
#include "blackmisc/fileutils.h"
|
||||
#include "blackmisc/htmlutils.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
|
||||
@@ -329,10 +331,10 @@ namespace BlackGui
|
||||
}
|
||||
else
|
||||
{
|
||||
const QString ms(m.join("<br>"));
|
||||
const QString ms = m.join("<br>");
|
||||
if (BrokenMultilinePlaceholder && m.size() > 1)
|
||||
{
|
||||
ui->pte_ModelDirectories->setToolTip(ms);
|
||||
ui->pte_ModelDirectories->setToolTip(unwrappedTooltip(ms));
|
||||
ui->pte_ModelDirectories->setPlaceholderText("See tooltip for defaults");
|
||||
}
|
||||
else
|
||||
@@ -348,11 +350,11 @@ namespace BlackGui
|
||||
}
|
||||
else
|
||||
{
|
||||
const QString es(e.join("<br>"));
|
||||
const QString es = e.join("<br>");
|
||||
if (BrokenMultilinePlaceholder && e.size() > 1)
|
||||
{
|
||||
//! \fixme correct version when Qt multiline placeholder is fixed https://bugreports.qt.io/browse/QTBUG-43817
|
||||
ui->pte_ExcludeDirectories->setToolTip(es);
|
||||
ui->pte_ExcludeDirectories->setToolTip(unwrappedTooltip(es));
|
||||
ui->pte_ExcludeDirectories->setPlaceholderText("See tooltip for defaults");
|
||||
}
|
||||
else
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include <QStringBuilder>
|
||||
#include "htmlutils.h"
|
||||
#include <QStringBuilder>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -24,18 +24,19 @@ namespace BlackMisc
|
||||
html += QStringLiteral("<tr>");
|
||||
for (int c = 0; c < columns; c++)
|
||||
{
|
||||
if (i < size)
|
||||
{
|
||||
html += QStringLiteral("<td>") % values.at(i) % QStringLiteral("</td>");
|
||||
}
|
||||
else
|
||||
{
|
||||
html += QStringLiteral("<td></td>");
|
||||
}
|
||||
html += (i < size) ?
|
||||
QStringLiteral("<td>") % values.at(i) % QStringLiteral("</td>") :
|
||||
QStringLiteral("<td></td>");
|
||||
i++;
|
||||
}
|
||||
html += QStringLiteral("</tr>");
|
||||
}
|
||||
return QStringLiteral("<table>") % html % QStringLiteral("</table>");
|
||||
}
|
||||
|
||||
QString unwrappedTooltip(const QString &text)
|
||||
{
|
||||
return QStringLiteral("<p style='white-space:pre'>") % text % QStringLiteral("</p>");
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#ifndef BLACKMISC_HTMLUTILS_H
|
||||
#define BLACKMISC_HTMLUTILS_H
|
||||
|
||||
#include <QStringBuilder>
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/propertyindexlist.h"
|
||||
#include <QStringBuilder>
|
||||
|
||||
//! Free functions in BlackMisc
|
||||
namespace BlackMisc
|
||||
@@ -39,6 +39,9 @@ namespace BlackMisc
|
||||
//! Values as HTML table
|
||||
BLACKMISC_EXPORT QString toHtmTable(const QStringList &values, int columns);
|
||||
|
||||
//! As white space preformatted
|
||||
BLACKMISC_EXPORT QString unwrappedTooltip(const QString &text);
|
||||
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
|
||||
Reference in New Issue
Block a user