From ca0c4f5a3dee0ad1f80a295044a8f9315ae28438 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Wed, 9 Oct 2019 13:44:46 +0200 Subject: [PATCH] Fix stylesheet warnings introduced by 3b330ee2 (#3610) Fixes regression introduced by 3b330ee. The previous changes could add an invalid style sheet to PasswordEdit's QLineEdit. --- src/gui/PasswordEdit.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gui/PasswordEdit.cpp b/src/gui/PasswordEdit.cpp index bc5cfc9f..37b82ad8 100644 --- a/src/gui/PasswordEdit.cpp +++ b/src/gui/PasswordEdit.cpp @@ -94,14 +94,14 @@ bool PasswordEdit::passwordsEqual() const void PasswordEdit::updateStylesheet() { - QString stylesheet("QLineEdit { background: %1; }"); + const QString stylesheetTemplate("QLineEdit { background: %1; }"); if (m_basePasswordEdit && !passwordsEqual()) { bool isCorrect = true; if (m_basePasswordEdit->text().startsWith(text())) { - stylesheet = stylesheet.arg(CorrectSoFarColor.name()); + setStyleSheet(stylesheetTemplate.arg(CorrectSoFarColor.name())); } else { - stylesheet = stylesheet.arg(ErrorColor.name()); + setStyleSheet(stylesheetTemplate.arg(ErrorColor.name())); isCorrect = false; } m_correctAction->setVisible(isCorrect); @@ -109,9 +109,8 @@ void PasswordEdit::updateStylesheet() } else { m_correctAction->setVisible(false); m_errorAction->setVisible(false); + setStyleSheet(""); } - - setStyleSheet(stylesheet); } void PasswordEdit::autocompletePassword(const QString& password)