Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan White <support@dmapps.us>2021-03-24 00:35:36 +0300
committerJonathan White <support@dmapps.us>2021-05-30 15:44:09 +0300
commit7f2281940da9a8382a6be937b036e89eeb032733 (patch)
tree34452753d2e2b51f2466e3e4f90e4ff724113c26
parentaaf8f188521a1742ded2fbd104cd594191d43a75 (diff)
Use application font size when setting default or monospace fonts
* Fix #6286
-rw-r--r--src/gui/Font.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gui/Font.cpp b/src/gui/Font.cpp
index 021380c29..8bb54863b 100644
--- a/src/gui/Font.cpp
+++ b/src/gui/Font.cpp
@@ -18,29 +18,29 @@
#include "Font.h"
#include <QFontDatabase>
+#include <QGuiApplication>
QFont Font::defaultFont()
{
- return QFontDatabase::systemFont(QFontDatabase::GeneralFont);
+ return qApp->font();
}
QFont Font::fixedFont()
{
- QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
+ auto fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
#ifdef Q_OS_WIN
// try to use Consolas on Windows, because the default Courier New has too many similar characters
- QFont consolasFont = QFontDatabase().font("Consolas", fixedFont.styleName(), fixedFont.pointSize());
- const QFont defaultFont;
- if (fixedFont != defaultFont) {
+ auto consolasFont = QFontDatabase().font("Consolas", fixedFont.styleName(), fixedFont.pointSize());
+ if (consolasFont.family().contains("consolas", Qt::CaseInsensitive)) {
fixedFont = consolasFont;
}
#endif
#ifdef Q_OS_MACOS
// Qt doesn't choose a monospace font correctly on macOS
- const QFont defaultFont;
- fixedFont = QFontDatabase().font("Menlo", defaultFont.styleName(), defaultFont.pointSize());
+ fixedFont = QFontDatabase().font("Menlo", fixedFont.styleName(), fixedFont.pointSize());
#endif
+ fixedFont.setPointSize(qApp->font().pointSize());
return fixedFont;
}