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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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