Fix that clearing shortcut in settings did no longer work

This broke in 8d1a592d16

We should ask the validator of a fancy line edit if an entry is valid,
also if the line edit is empty and shows a placeholder text, even if we
then do not mark the place holder with the error color, etc.

In case of the shortcut settings, the validator has side effects that
are important.

Change-Id: I41c0d98ed3c6e9e68df4484a47c108b00ddbbfe7
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2018-03-20 15:41:39 +01:00
parent 3ef455da18
commit 26bfa469db

View File

@@ -445,9 +445,9 @@ void FancyLineEdit::validate()
d->m_errorMessage.clear(); d->m_errorMessage.clear();
// Are we displaying the placeholder text? // Are we displaying the placeholder text?
const bool isDisplayingPlaceholderText = !placeholderText().isEmpty() && t.isEmpty(); const bool isDisplayingPlaceholderText = !placeholderText().isEmpty() && t.isEmpty();
const State newState = isDisplayingPlaceholderText ? const bool validates = d->m_validationFunction(this, &d->m_errorMessage);
DisplayingPlaceholderText : const State newState = isDisplayingPlaceholderText ? DisplayingPlaceholderText
(d->m_validationFunction(this, &d->m_errorMessage) ? Valid : Invalid); : (validates ? Valid : Invalid);
setToolTip(d->m_errorMessage); setToolTip(d->m_errorMessage);
// Changed..figure out if valid changed. DisplayingPlaceholderText is not valid, // Changed..figure out if valid changed. DisplayingPlaceholderText is not valid,
// but should not show error color. Also trigger on the first change. // but should not show error color. Also trigger on the first change.