QComboBox - optimize (improve stupid code at enter-key)
There is no need to do a search for an item if we already have the correct index. Change-Id: Iac0e7df7573b71b82aa491acb8e289fe02fb3285 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
This commit is contained in:
parent
e08aca15ec
commit
6dec40628b
@ -1136,10 +1136,9 @@ Qt::MatchFlags QComboBoxPrivate::matchFlags() const
|
||||
void QComboBoxPrivate::_q_editingFinished()
|
||||
{
|
||||
Q_Q(QComboBox);
|
||||
if (lineEdit && !lineEdit->text().isEmpty()) {
|
||||
//here we just check if the current item was entered
|
||||
if (lineEdit && !lineEdit->text().isEmpty() && itemText(currentIndex) != lineEdit->text()) {
|
||||
const int index = q_func()->findText(lineEdit->text(), matchFlags());
|
||||
if (index != -1 && itemText(currentIndex) != lineEdit->text()) {
|
||||
if (index != -1) {
|
||||
q->setCurrentIndex(index);
|
||||
emitActivated(currentIndex);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user