PDA

View Full Version : QComboBox autocompletion question



Zwil
25th July 2014, 17:55
Hi,

I'm new to Qt and have a question about QComboBox and autocompletion.

I have a QComboBox loaded with a bunch of colors as the items. I set editable as false and set QApplication::setKeyboardInputInterval() to 2000 and the autocomplete works as I want it to except for items with spaces.

Colors loaded in the combobox:
Black
Blue
White
Dark Blue
Dark Green

If I type 'b' the box shows Black
If I type 'bl' the box shows Black
If I type 'blu' the box shows Blue. All these are fine.

If I type 'dark ' (note the space after) the box shows Dark Blue and the popup menu comes up and stops any keypresses from registering until I click on a choice in the popup or hit escape. This stops me from typing 'dark g' to get to Dark Green.

I read that the space is the shortcut for the popup menu. How can I suppress the popup while still matching the text containing the space?
Is there another (or better) way to do this besides a combobox? Any information or code snippets are greatly appreciated.

Thanks
-Zwil

Zwil
26th July 2014, 15:22
Uncheck editable Zwil.

Nevermind figured it out.