PDA

View Full Version : completer and QComboBox



olosie
15th May 2009, 14:38
How can I use completer in QComboBox when I use editable=false ?
I have a lot of data in database and completer will be usefull to find correct row.

wysota
15th May 2009, 22:23
Using a completer with a combo box doesn't make any sense... You can use it with a line edit but a combo box already acts as a completer - start typing on your keyboard when it has focus and you'll see.

olosie
16th May 2009, 07:44
Standard completer in combobox (when editable=false) works only for first letter but I want add something like search term.

faldzip
16th May 2009, 08:09
How can I use completer in QComboBox when I use editable=false ?
And how it should work if the combo box would be not editable? Make it editable and, as wysota said, it would be working as a completer.

aamer4yu
16th May 2009, 09:26
You will need to write your own completer for that and set on combo box (QComboBox::setCompleter ) .
You can have look at QCompleter examples in Tools section in Qt Demos.

olosie
16th May 2009, 18:38
And how it should work if the combo box would be not editable? Make it editable and, as wysota said, it would be working as a completer.

editable is a bad solution because someone can write anything in editline (not only rows from database).

aamer4yu
16th May 2009, 19:04
You need to write to search, dont you ?
And by making combobox editable, it doesnt mean you can chage the existing entries. I guess combobox adds entries when u press return, but that behaviour can be easily overriden.

olosie
16th May 2009, 19:25
You need to write to search, dont you ?
And by making combobox editable, it doesnt mean you can chage the existing entries. I guess combobox adds entries when u press return, but that behaviour can be easily overriden.

Yes exactly :)
I think the best solution is to extend current reaction on popup list (search by one key) in combobox. Is it possible to grab keys from popup list?

aamer4yu
17th May 2009, 10:34
Can you explain what you try to achieve ?
You have told us what you have tried, but ur goals are still not clear. Might be there is a better way :)