diff options
author | Thorbjørn Martsum <tmartsum@gmail.com> | 2013-07-07 14:59:27 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-10 20:06:26 +0200 |
commit | 6dec40628b48c673bff8d8fb341ddfdae9189f64 (patch) | |
tree | ec82fae7e4e5521425b84e46d836cc946878c6ae /src | |
parent | e08aca15ec91ce7d22873c3edde44c6acc27095b (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 6103b9b4c2..c59edf295c 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -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); } |