PDA

View Full Version : Searching an item in QCombobox



ramarolahyangelo
21st December 2010, 06:23
Hi everybody,

I have a little knowledge in Qt but It is the first time I have this problem.

I have used a QComboBox, and I have insert many items on it (300 items).

My problem is : how to show an item which begin by a letter "A" for example.

Regards,

Lykurg
21st December 2010, 07:05
I have a little knowledge in Qt but It is the first time I have this problem.
Then please use the newbe section.

Use QComboBox::findText() or QComboBox::findData() and combine the result with QComboBox::setCurrentIndex().

ramarolahyangelo
21st December 2010, 08:51
thanks!

I try this option, I will give the result as soon as possible!

Regards,

Added after 20 minutes:

I have finished to try your purpose.

I have just turned "setEditable()" to true
and automatically, the QComboBox show the item if it exists when I press a letter!

Thanks a lot!

Added after 1 5 minutes:

My last question about this subject is :
Is It possible to search an item in an editable QComboBox, but not to modify the content if the keyword doesn't exist?

Best Regards,