Skip to content

Commit

Permalink
Fix stylesheet warnings introduced by 3b330ee (#3610)
Browse files Browse the repository at this point in the history
Fixes regression introduced by 3b330ee.
The previous changes could add an invalid style
sheet to PasswordEdit's QLineEdit.
  • Loading branch information
phoerious authored Oct 9, 2019
1 parent a93b22f commit ca0c4f5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/gui/PasswordEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,24 +94,23 @@ 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);
m_errorAction->setVisible(!isCorrect);
} else {
m_correctAction->setVisible(false);
m_errorAction->setVisible(false);
setStyleSheet("");
}

setStyleSheet(stylesheet);
}

void PasswordEdit::autocompletePassword(const QString& password)
Expand Down

0 comments on commit ca0c4f5

Please sign in to comment.