• 6313阅读
  • 5回复

ComboBox怎么显示增加的项目? [复制链接]

上一主题 下一主题
离线青春岁月
 

只看楼主 倒序阅读 楼主  发表于: 2011-03-03
ComboBox怎么显示增加的项目?
go!   go!  go!  go!
离线kimtaikee

只看该作者 1楼 发表于: 2011-03-03
你增加了哪个就设置哪个为当前的呗

离线sbtree
只看该作者 2楼 发表于: 2011-03-03
这个问题太模糊,不太理解其意。难道你添加的条目在ComboBox的下拉列表中看不到吗?还是说你想把新添加的条目设置成当前的条目?有一个函数叫setCurrentIndex,可以试试看,参数是你新添加的条目的索引号
[ 此帖被sbtree在2011-03-03 20:32重新编辑 ]
windows 7 + VC++2008 + Qt4.5.2
离线alexltr

只看该作者 3楼 发表于: 2011-03-03

是不是这个啊。
insertPolicy : InsertPolicy
This property holds the policy used to determine where user-inserted items should appear in the combobox.
The default value is AtBottom, indicating that new items will appear at the bottom of the list of items.
Access functions:
[table=1063px][tr][td]InsertPolicy[/td][td]insertPolicy () const[/td][/tr][tr][td]void[/td][td]setInsertPolicy ( InsertPolicy policy )[/td][/tr][/table]


enum QComboBox::InsertPolicy

This enum specifies what the QComboBox should do when a new string is entered by the user.
ConstantValueDescription
QComboBox::NoInsert0The string will not be inserted into the combobox.
QComboBox::InsertAtTop1The string will be inserted as the first item in the combobox.
QComboBox::InsertAtCurrent2The current item will be replaced by the string.
QComboBox::InsertAtBottom3The string will be inserted after the last item in the combobox.
QComboBox::InsertAfterCurrent4The string is inserted after the current item in the combobox.
QComboBox::InsertBeforeCurrent5The string is inserted before the current item in the combobox.
QComboBox::InsertAlphabetically6The string is inserted in the alphabetic order in the combobox.


我不从事IT,只是喜欢Qt。
我不是程序员,只是与程序有缘。
我写程序,只是为了让工作变得简单有序!

                      ----  一个一直在入门的编程学习者
离线青春岁月

只看该作者 4楼 发表于: 2011-03-10
我的意思是,我增加一个项目,然后显示增加项目的名字?无法显示怎么处理啊?
go!   go!  go!  go!
离线青春岁月

只看该作者 5楼 发表于: 2011-03-10
回 3楼(alexltr) 的帖子
我的意思是,我增加一个项目,然后显示增加项目的名字?无法显示怎么处理啊???
go!   go!  go!  go!
快速回复
限100 字节
 
上一个 下一个