mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-04 08:55:31 -05:00
Use application font size when setting default or monospace fonts
* Fix #6286
This commit is contained in:
parent
871c4fffdd
commit
86ddd702fb
@ -18,29 +18,29 @@
|
|||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
|
|
||||||
#include <QFontDatabase>
|
#include <QFontDatabase>
|
||||||
|
#include <QGuiApplication>
|
||||||
|
|
||||||
QFont Font::defaultFont()
|
QFont Font::defaultFont()
|
||||||
{
|
{
|
||||||
return QFontDatabase::systemFont(QFontDatabase::GeneralFont);
|
return qApp->font();
|
||||||
}
|
}
|
||||||
|
|
||||||
QFont Font::fixedFont()
|
QFont Font::fixedFont()
|
||||||
{
|
{
|
||||||
QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
auto fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
// try to use Consolas on Windows, because the default Courier New has too many similar characters
|
// 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());
|
auto consolasFont = QFontDatabase().font("Consolas", fixedFont.styleName(), fixedFont.pointSize());
|
||||||
const QFont defaultFont;
|
if (consolasFont.family().contains("consolas", Qt::CaseInsensitive)) {
|
||||||
if (fixedFont != defaultFont) {
|
|
||||||
fixedFont = consolasFont;
|
fixedFont = consolasFont;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
// Qt doesn't choose a monospace font correctly on macOS
|
// Qt doesn't choose a monospace font correctly on macOS
|
||||||
const QFont defaultFont;
|
fixedFont = QFontDatabase().font("Menlo", fixedFont.styleName(), fixedFont.pointSize());
|
||||||
fixedFont = QFontDatabase().font("Menlo", defaultFont.styleName(), defaultFont.pointSize());
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
fixedFont.setPointSize(qApp->font().pointSize());
|
||||||
return fixedFont;
|
return fixedFont;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user