ui.combobox->clear();ui.combobox->addItem(tr("全部"), -1);
2 回答

有只小跳蛙
TA贡献1824条经验 获得超8个赞
void QComboBox::addItem ( const QString & text, const QVariant & userData= QVariant() )
Adds an item to the combobox with the given text, and containing the specified userData (stored in the Qt::UserRole). The item is appended to the list of existing items.
所以后面都不是索引,使用户自定义的数据,具体意义看用户定义。

眼眸繁星
TA贡献1873条经验 获得超9个赞
我查了Qt的Assistant,additem没有带索引的重载啊。insertitem到是有索引,不过也没有你这种调用法,你可以仔细查看Assistant,负索引是在组合框的前面添加项
- 2 回答
- 0 关注
- 136 浏览
添加回答
举报
0/150
提交
取消