QLineEdit should inherit the input methods from QComboBox.

Task-number: QTBUG-39088
Change-Id: I4dfe9a052c20a4cb0a9d6b0d3337cb5095a3694f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
BogDan Vatra 2015-07-07 16:23:21 +03:00
parent 17caa94190
commit d800047dc5
2 changed files with 10 additions and 0 deletions

View File

@ -1764,6 +1764,7 @@ void QComboBox::setLineEdit(QLineEdit *edit)
delete d->lineEdit;
d->lineEdit = edit;
qt_widget_private(d->lineEdit)->inheritsInputMethodHints = 1;
if (d->lineEdit->parent() != this)
d->lineEdit->setParent(this);
connect(d->lineEdit, SIGNAL(returnPressed()), this, SLOT(_q_returnPressed()));

View File

@ -164,6 +164,7 @@ private slots:
void keyboardSelection();
void setCustomModelAndView();
void updateDelegateOnEditableChange();
void task_QTBUG_39088_inputMethodHints();
};
class MyAbstractItemDelegate : public QAbstractItemDelegate
@ -3169,5 +3170,13 @@ void tst_QComboBox::updateDelegateOnEditableChange()
}
}
void tst_QComboBox::task_QTBUG_39088_inputMethodHints()
{
QComboBox box;
box.setEditable(true);
box.setInputMethodHints(Qt::ImhNoPredictiveText);
QCOMPARE(box.lineEdit()->inputMethodHints(), Qt::ImhNoPredictiveText);
}
QTEST_MAIN(tst_QComboBox)
#include "tst_qcombobox.moc"