From f2003b4087e322104c7639eee8b0eeb46cf31e9c Mon Sep 17 00:00:00 2001 From: ryain11 Date: Mon, 7 Sep 2026 16:14:55 +0300 Subject: [PATCH] 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. --- src/gui/PasswordWidget.cpp | 15 ++++++++++----- src/gui/PasswordWidget.h | 3 +++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/gui/PasswordWidget.cpp b/src/gui/PasswordWidget.cpp index bf4def3de..d1047ae33 100644 --- a/src/gui/PasswordWidget.cpp +++ b/src/gui/PasswordWidget.cpp @@ -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) { diff --git a/src/gui/PasswordWidget.h b/src/gui/PasswordWidget.h index 3530d9888..602860122 100644 --- a/src/gui/PasswordWidget.h +++ b/src/gui/PasswordWidget.h @@ -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();