FancyLineEdit: Refactor class

Rename the code that evaluates the text and make it a public
slot.

Change-Id: I843bf505fa6e33661fc840a1fd2ec13ceb210037
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2015-10-12 14:57:20 +02:00
parent c455e78781
commit 629c24abdc
5 changed files with 11 additions and 28 deletions

View File

@@ -169,7 +169,7 @@ FancyLineEdit::FancyLineEdit(QWidget *parent) :
connect(d->m_iconbutton[Left], &QAbstractButton::clicked, this, &FancyLineEdit::iconClicked);
connect(d->m_iconbutton[Right], &QAbstractButton::clicked, this, &FancyLineEdit::iconClicked);
connect(this, &QLineEdit::textChanged, this, &FancyLineEdit::onTextChanged);
connect(this, &QLineEdit::textChanged, this, &FancyLineEdit::validate);
}
FancyLineEdit::~FancyLineEdit()
@@ -451,8 +451,10 @@ QString FancyLineEdit::errorMessage() const
return d->m_errorMessage;
}
void FancyLineEdit::onTextChanged(const QString &t)
void FancyLineEdit::validate()
{
const QString t = text();
if (d->m_isFiltering){
if (t != d->m_lastFilterText) {
d->m_lastFilterText = t;
@@ -498,17 +500,11 @@ void FancyLineEdit::onTextChanged(const QString &t)
handleChanged(t);
}
void FancyLineEdit::triggerChanged()
{
onTextChanged(text());
}
QString FancyLineEdit::fixInputString(const QString &string)
{
return string;
}
//
// IconButton - helper class to represent a clickable icon
//