PDA

View Full Version : QComboBox with QCompleter



cic
27th September 2013, 08:40
Hello all,

after the completer is set to combobox,

the combobox doesn't have the items. is it correct?



QComboBox box;
box.setEditable(true);

//box.addItem("a1");
//box.addItem("a2");
//box.addItem("a3");

QStringList list;
list << "a1" << "a2" << "a3";

QCompleter com(list);
com.setCaseSensitivity(Qt::CaseInsensitive);
com.setCompletionMode(QCompleter::PopupCompletion) ;

box.setCompleter(&com);

// int num = box.count();
box.show();


here num is 0, and if you push the button of dropdown menu, there is no element shown.
only when you input something e.g "a", the meet results are shown.

does it mean for the combobox list, we need to call addItem to set it again?

anda_skoa
27th September 2013, 19:21
I am not sure what your problem is.

You say that the completer works and you say that the combobox is empty just the way you've created it.
Seems to me that both object work as expected.

Cheers,
_