我有QComboBox的问题.我需要一个带有tableview项目的组合框.
例如,QComboBox的默认值为:
???????????
? ? ?
???????????
? index 0 ?
???????????
? index 1 ?
???????????
? index 2 ?
???????????
? index 3 ?
???????????
Run Code Online (Sandbox Code Playgroud)
我需要像这样创建ComboBox:
?????????????????????
? ? ?
?????????????????????
? index 0 ? index 1 ?
?????????????????????
? index 2 ? index 3 ?
?????????????????????
Run Code Online (Sandbox Code Playgroud)
我写了样本,但它无法正常工作:
QTableView *table = new QTableView(this);
QComboBox *cb = new QComboBox;
ui->verticalLayout->addWidget(cb);
cb->setView(table);
QStandardItemModel *model = new QStandardItemModel(2,2);
cb->setModel(model);
int x = 0;
int y = 0;
for (int i=0; i<4; …Run Code Online (Sandbox Code Playgroud)