PDA

View Full Version : completion mode when obtaining index with QCompleter using QLineEdit



schnitzel
11th January 2011, 19:22
I configured a QLineEdit with a list of names. I can get the completer to work correctly when using QCompleter::UnfilteredPopupCompletion, i.e. the activated(QModelIndex indx) provides me with the correct index with the indx.row() method. However, if I change the CompletionMode, to QCompleter::PopupCompletion then the row() method doesn't provide the 'absolute' index into my list, but rather a 'relative' (for lack of better description) as it indicates the index of the current possible matches. How do I get the same index as in the case of UnfilteredPopupCompletion when typing the same name?

schnitzel
12th January 2011, 22:40
never mind...
I took another look at the Completer example and I think I should just use a QStandardItemModel with an additional column for use as index and not show it.
I'll report back when I get it to work.