Skip to content

Commit

Permalink
chore: Improve look of hwlabel to better match manual
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Apr 4, 2024
1 parent 35ed4cd commit e9788a4
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/controllers/legacycontrollersettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,19 @@ namespace {
const QRegularExpression kHwbtnRe(QStringLiteral(":hwbtn:`([^`]*)`"));

const QString kHwbtnStyleWrapper = QStringLiteral(
"<span style='background-color: #111111; "
"color: #d9d9d9; "
"font-weight: 700;'>"
// wrapping the string in &nbsp; is apparently the only way to get a padding
// \\1 is the RegEx match group 1
"&nbsp;\\1&nbsp;</span>");
"<span style='"
"background: #343131;"
"color: #d9d9d9;"
"font-size: 70%;"
"font-weight: 600;"
"line-height: 120%;"
"text-transform: uppercase;"
// Padding does only work with block and table-cell elements, not
// inline span. Hence, wrapping the string in `&nbsp;` is the only way
// to get the desired look here. See the Qt documentation for details:
// https://doc.qt.io/qt-6/richtext-html-subset.html#css-properties
// \\1 is the RegEx match group 1.
"'>&nbsp;\\1&nbsp;</span>");

QString replaceMarkupStyleStr(QString str) {
return str.replace(kHwbtnRe, kHwbtnStyleWrapper);
Expand Down

0 comments on commit e9788a4

Please sign in to comment.