Do not emit textEdited on inputMask change

Task-number: QTBUG-1266
Change-Id: Ib2f1db15be876c1d6713bd7c28c2b91006b3b2d4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
This commit is contained in:
Joni Poikelin 2015-02-25 14:14:53 +02:00 committed by Joni Poikelin
parent ef9e742711
commit fa3985ab22
2 changed files with 13 additions and 2 deletions

View File

@ -936,7 +936,7 @@ void QWidgetLineControl::parseInputMask(const QString &maskFields)
delete [] m_maskData;
m_maskData = 0;
m_maxLength = 32767;
internalSetText(QString());
internalSetText(QString(), -1, false);
}
return;
}
@ -1022,7 +1022,7 @@ void QWidgetLineControl::parseInputMask(const QString &maskFields)
}
}
}
internalSetText(m_text);
internalSetText(m_text, -1, false);
}

View File

@ -308,6 +308,7 @@ private slots:
void shouldShowPlaceholderText_data();
void shouldShowPlaceholderText();
void QTBUG1266_setInputMaskEmittingTextEdited();
protected slots:
void editingFinished();
@ -4362,5 +4363,15 @@ void tst_QLineEdit::shouldShowPlaceholderText()
}
void tst_QLineEdit::QTBUG1266_setInputMaskEmittingTextEdited()
{
QLineEdit lineEdit;
lineEdit.setText("test");
QSignalSpy spy(&lineEdit, SIGNAL(textEdited(QString)));
lineEdit.setInputMask("AAAA");
lineEdit.setInputMask(QString());
QVERIFY(spy.count() == 0);
}
QTEST_MAIN(tst_QLineEdit)
#include "tst_qlineedit.moc"