summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorAndre Hartmann <aha_1980@gmx.de>2014-12-29 10:35:09 +0100
committerAndré Hartmann <aha_1980@gmx.de>2015-03-18 16:57:19 +0000
commite610ef8c8d156f8e70a51c719458eaea1b2266a8 (patch)
treebace99e38b9454cd99d360804fa8cf775e4deea4 /src/widgets
parentf64b87a5df8870be138dbf3febad950e1fc4ed8c (diff)
QComboBox: Update completer on setCurrentIndex()
When the ComboBox currentText() was changed by key LineUp or LineDown or mouse click, the completer still contained the last inserted characters. If now all text was selected (by Ctrl+A or selectAll()), the old item and index was restored on next Enter press. Task-number: QTBUG-41288 Change-Id: I6916fd31c8b8fbacfb12e1a62c3e46823cf918b4 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/widgets/qcombobox.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 40cf2f0f95..3555c5f261 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -2074,8 +2074,11 @@ void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi)
currentIndex = QPersistentModelIndex(normalized);
if (lineEdit) {
const QString newText = itemText(normalized);
- if (lineEdit->text() != newText)
+ if (lineEdit->text() != newText) {
lineEdit->setText(newText);
+ if (lineEdit->completer())
+ lineEdit->completer()->setCompletionPrefix(newText);
+ }
updateLineEditGeometry();
}
if (indexChanged) {