Fix password font size not changing

* Move font size application to showEvent instead of constructor to enable dynamic font size application if changed in app settings.
This commit is contained in:
ryain11 authored and Janek Bevendorff committed 2026-09-20 20:40:18 +02:00
1 parent 126f508e6a
commit f2003b4087
2 files changed
+13 -5

No files matched your search

+10 -5
View File
@@ -52,11 +52,6 @@ PasswordWidget::PasswordWidget(QWidget* parent)
setEchoMode(QLineEdit::Password);
// use a monospace font for the password field
QFont passwordFont = Font::fixedFont();
passwordFont.setLetterSpacing(QFont::PercentageSpacing, 110);
m_ui->passwordEdit->setFont(passwordFont);
// Prevent conflicts with global Mac shortcuts (force Control on all platforms)
#ifdef Q_OS_MAC
constexpr auto modifier = Qt::MetaModifier;
@@ -244,6 +239,16 @@ bool PasswordWidget::eventFilter(QObject* watched, QEvent* event)
return false;
}
void PasswordWidget::showEvent(QShowEvent* event)
{
QWidget::showEvent(event);
// use a monospace font for the password field
QFont passwordFont = Font::fixedFont();
passwordFont.setLetterSpacing(QFont::PercentageSpacing, 110);
m_ui->passwordEdit->setFont(passwordFont);
}
void PasswordWidget::checkCapslockState()
{
if (m_parentPasswordWidget) {
+3
View File
@@ -60,6 +60,9 @@ public slots:
void setEchoMode(QLineEdit::EchoMode mode);
void setClearButtonEnabled(bool enabled);
protected:
void showEvent(QShowEvent* event) override;
private slots:
void popupPasswordGenerator();
void updateRepeatStatus();