Settings for default tree & listwidget fonts

This commit is contained in:
defnax 2025-02-05 20:55:03 +01:00
parent 8fcc52b304
commit e14fc66ca3
14 changed files with 180 additions and 1 deletions

View file

@ -230,6 +230,7 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
int ltwH = misc::getFontSizeFactor("LobbyTreeWidget", 1.5).height();
ui.lobbyTreeWidget->setIconSize(QSize(ltwH,ltwH));
updateFontSize();
}
ChatLobbyWidget::~ChatLobbyWidget()
@ -1368,3 +1369,25 @@ int ChatLobbyWidget::getNumColVisible()
}
return iNumColVis;
}
void ChatLobbyWidget::showEvent(QShowEvent *event)
{
if (!event->spontaneous()) {
updateFontSize();
}
}
void ChatLobbyWidget::updateFontSize()
{
#if defined(Q_OS_DARWIN)
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 13).toInt();
#else
int customFontSize = Settings->valueFromGroup("File", "MinimumFontSize", 11).toInt();
#endif
QFont newFont = ui.lobbyTreeWidget->font();
if (newFont.pointSize() != customFontSize) {
newFont.setPointSize(customFontSize);
QFontMetricsF fontMetrics(newFont);
ui.lobbyTreeWidget->setFont(newFont);
}
}