forked from qt-creator/qt-creator
FancyLineEdit: Remove property initialText
The same can be easily achieved by placeholderText nowadays. Change-Id: Icfe0652ae8536c8077cf45a03844275aa1eddad6 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
André Hartmann
parent
310a2bf96f
commit
8d1a592d16
@@ -105,7 +105,6 @@ public:
|
||||
QColor m_okTextColor;
|
||||
QColor m_errorTextColor = Qt::red;
|
||||
QString m_errorMessage;
|
||||
QString m_initialText;
|
||||
};
|
||||
|
||||
FancyLineEditPrivate::FancyLineEditPrivate(FancyLineEdit *parent) :
|
||||
@@ -373,20 +372,6 @@ void FancyLineEdit::setFiltering(bool on)
|
||||
}
|
||||
}
|
||||
|
||||
QString FancyLineEdit::initialText() const
|
||||
{
|
||||
return d->m_initialText;
|
||||
}
|
||||
|
||||
void FancyLineEdit::setInitialText(const QString &t)
|
||||
{
|
||||
if (d->m_initialText != t) {
|
||||
d->m_initialText = t;
|
||||
d->m_firstChange = true;
|
||||
setText(t);
|
||||
}
|
||||
}
|
||||
|
||||
QColor FancyLineEdit::errorColor() const
|
||||
{
|
||||
return d->m_errorTextColor;
|
||||
@@ -458,13 +443,13 @@ void FancyLineEdit::validate()
|
||||
}
|
||||
|
||||
d->m_errorMessage.clear();
|
||||
// Are we displaying the initial text?
|
||||
const bool isDisplayingInitialText = !d->m_initialText.isEmpty() && t == d->m_initialText;
|
||||
const State newState = isDisplayingInitialText ?
|
||||
DisplayingInitialText :
|
||||
// Are we displaying the placeholder text?
|
||||
const bool isDisplayingPlaceholderText = !placeholderText().isEmpty() && t.isEmpty();
|
||||
const State newState = isDisplayingPlaceholderText ?
|
||||
DisplayingPlaceholderText :
|
||||
(d->m_validationFunction(this, &d->m_errorMessage) ? Valid : Invalid);
|
||||
setToolTip(d->m_errorMessage);
|
||||
// Changed..figure out if valid changed. DisplayingInitialText 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.
|
||||
if (newState != d->m_state || d->m_firstChange) {
|
||||
const bool validHasChanged = (d->m_state == Valid) != (newState == Valid);
|
||||
|
||||
Reference in New Issue
Block a user