QT QComboBox学习
QT QComboBox学习
1.addItems
void DataDownload::getFileListSlot(QByteArray byteArray)
{
int count = ui.comboBox_2->count()-1;
for (int i = 0; i < count; i++) //不能用ui.comboBox_2->count()替换count
ui.comboBox_2->removeItem(1); //参数index随时在变,每次只能删除index为1的项目,也可以每次删除index(=ui.comboBox_2->count())项目
QStringList itemList;
for (int i = 0; i < (byteArray.size()-12) / 8; i++)
{
itemList.append(byteArray.mid(11+8 * i, 8));
}
ui.comboBox_2->addItems(itemList);
}