mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-26 07:49:50 -05:00
Use Consolas on Windows for PasswordEdit instead of the default Courier New, resolves #1226
This commit is contained in:
parent
e17b3d24bf
commit
8905fe5a54
@ -31,9 +31,18 @@ PasswordEdit::PasswordEdit(QWidget* parent)
|
||||
{
|
||||
setEchoMode(QLineEdit::Password);
|
||||
updateStylesheet();
|
||||
|
||||
// set font to system monospace font and increase letter spacing
|
||||
|
||||
// use a monospace font for the password field
|
||||
QFont passwordFont = 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", passwordFont.styleName(), passwordFont.pointSize());
|
||||
const QFont defaultFont;
|
||||
if (passwordFont != defaultFont) {
|
||||
passwordFont = consolasFont;
|
||||
}
|
||||
#endif
|
||||
|
||||
passwordFont.setLetterSpacing(QFont::PercentageSpacing, 110);
|
||||
setFont(passwordFont);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user