开发者

qt how to obtain a button that when you click it presents you a list of elements where you can select somethng?

开发者 https://www.devze.com 2023-03-26 06:09 出处:网络
I am new to Qt Creator. I want to add on my form a button that when you click it presents you a list of names for example (i\'m talking about a dropd开发者_开发知识库own button i guess). i didn\'t fin

I am new to Qt Creator. I want to add on my form a button that when you click it presents you a list of names for example (i'm talking about a dropd开发者_开发知识库own button i guess). i didn't find it in qt creator.

Thx!


It's called ComboBox in Qt Creator, it's in the "Input Widgets" category.

Edit:

To select some specific text, you need to find the index of the text, then select that index:

int index = comboBox->findText(someText);
comboBox->setSelectedIndex(index);
0

精彩评论

暂无评论...
验证码 换一张
取 消