Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
4.5.0
-
None
Description
Test case
1) create a editable QComboBox
2) enter into QComboBox , a partial match for a value in qcombox , eg "Firs"
3) in the QCompleter popup the list and select with mouse a chose in popup
4) QComboBox::currentIndex() idealy be changed to suit the selection made with mouse, however selection can be accepted by pressing <Enter> on the keyboard
Workarounds offered :
#1 to get the real selected index you can match the current text of the combobox in the model
QModelIndexList list = combobox->model()->match(
combobox->model()->index( 0, 0 ), Qt::DisplayRole,
combobox->currentText(), 1, Qt::MatchExactly );
if( list.size() > 0 )
...
#2 you can also connect to the activated signal of the completer
QObject::connect(cb->completer(), SIGNAL(activated(QString)), lineEdit, SLOT(setText(QString)));