From 7f0f6380b132be76e6d5293b7b357918b7cb3d56 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 4 Aug 2015 13:37:00 +0200 Subject: [PATCH] QComboBox: make editable comboboxes usable with input methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QComboBox uses a QLineEdit for text editing. But while editing, the combobox is the widget having focus, not the line edit. Instead the combobox forwards all the IM events to the line edit internally. This causes a problem since the line edit will not be able to update the platforms IM state in QWidget::updateMicroFocus() since it doesn't have focus. The result will be that the platforms IM state will get out of sync with the QLineEdit. This patch will add the missing connections that lets QComboBox update the platforms IM state when the inner QLineEdit signals that its needed. Change-Id: Ic3e0fdbf155d4dbeab31e2cd859f6e425ae87375 Reviewed-by: Tor Arne Vestbø --- src/widgets/widgets/qcombobox.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 17762eb39d..4840b75c1b 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -1771,6 +1771,8 @@ void QComboBox::setLineEdit(QLineEdit *edit) connect(d->lineEdit, SIGNAL(editingFinished()), this, SLOT(_q_editingFinished())); connect(d->lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(editTextChanged(QString))); connect(d->lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(currentTextChanged(QString))); + connect(d->lineEdit, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(updateMicroFocus())); + connect(d->lineEdit, SIGNAL(selectionChanged()), this, SLOT(updateMicroFocus())); d->lineEdit->setFrame(false); d->lineEdit->setContextMenuPolicy(Qt::NoContextMenu); d->updateFocusPolicy();