Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我创建了一个QComboBox委托,用于 a 的单个列QTableView(该列的每个单元格都是一个单独的combobox),我想在我combobox的数据库返回中显示的数据作为由 a 分隔的 id 字符串; 我的问题是,如何combobox用数据库检索到的数据填充我的数据。
QComboBox
QTableView
combobox
;
澄清一下:有问题的列检索特定的 Id(4 位字符串),有时一个对象可能有多个 Id(由 分隔;),我想为combobox具有多个 Id 的单元格创建一个,以便用户可以选择他们想要的工作和。
也许这样的事情会起作用:
QString data = "Id01;Id02;Id03;Id04;Id05"; QStringList list = data.split(";"); QComboBox *comboBox = new QComboBox; comboBox->insertItems(0, list);