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

@ -67,6 +67,7 @@
#include "notifyqt.h"
#include "common/UserNotify.h"
#include "gui/ServicePermissionDialog.h"
#include "gui/settings/rsharesettings.h"
#ifdef UNFINISHED
#include "unfinished/ApplicationWindow.h"
@ -1022,6 +1023,7 @@ void SetForegroundWindowInternal(HWND hWnd)
/* Show the dialog. */
raiseWindow();
/* Set the focus to the specified page. */
_instance->ui->stackPages->setCurrentPage(page);
}
@ -1819,6 +1821,31 @@ void MainWindow::setCompactStatusMode(bool compact)
//opModeStatus: TODO Show only ???
}
void MainWindow::showEvent(QShowEvent *event)
{
if (!event->spontaneous()) {
updateFontSize();
}
}
void MainWindow::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->listWidget->font();
if (newFont.pointSize() != customFontSize) {
newFont.setPointSize(customFontSize);
QFontMetricsF fontMetrics(newFont);
int iconHeight = fontMetrics.height()*1.5;
ui->listWidget->setFont(newFont);
ui->toolBarPage->setFont(newFont);
ui->listWidget->setIconSize(QSize(iconHeight, iconHeight));
}
}
Gui_InputDialogReturn MainWindow::guiInputDialog(const QString& windowTitle, const QString& labelText, QLineEdit::EchoMode textEchoMode, bool modal)
{