mess with the font rendering of the home screen until it works (#6563)

* mess with the font rendering of the home screen until it works

* add more fonts
This commit is contained in:
ebbit1q
2026-01-25 07:37:19 +01:00
committed by GitHub
parent 49e6cf95c4
commit 92f02fa4ee

View File

@@ -41,6 +41,8 @@ QString HomeStyledButton::generateButtonStylesheet(const QPair<QColor, QColor> &
return QString(R"(
QPushButton {
font-size: 34px;
font-weight: bold;
font-family: sans-serif, "Segoe UI", "Helvetica Neue";
padding: 30px;
color: white;
border: 2px solid %1;
@@ -88,16 +90,12 @@ void HomeStyledButton::paintEvent(QPaintEvent *event)
painter.setRenderHint(QPainter::Antialiasing);
painter.setRenderHint(QPainter::TextAntialiasing);
QFont font = this->font();
font.setBold(true);
painter.setFont(font);
QFontMetrics fm(font);
QSize textSize = fm.size(Qt::TextSingleLine, this->text());
QFontMetrics fm(font());
QSize textSize = fm.size(Qt::TextSingleLine, text());
QPointF center((width() - textSize.width()) / 2.0, (height() + textSize.height() / 2.0) / 2.0);
QPainterPath path;
path.addText(center, font, this->text());
path.addText(center, font(), text());
painter.setPen(QPen(Qt::black, 2.0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setBrush(Qt::white);