jahyun
jahyun

Reputation: 21

How to insert to Combobox into Tablewidget

QComboBox *combo1 = new QComboBox(this);

QStringList list;
list <<"TRUE"<<"FALSE";
combo1 = new QComboBox(this);
combo1->addItems(list);


for(int i=0;i<ui->tableWidget->rowCount();i++){

    if(a[i]==true){
        combo1->setCurrentIndex(0);
         ui->tableWidget->setCellWidget(i,2,combo1);
    }
    else{
        combo1->setCurrentIndex(1);
         ui->tableWidget->setCellWidget(i,2,combo1);
    }


}

my source code. last cell change combobox. but Except last cell, All cell not combobox, i want all cell change combobox

Upvotes: 0

Views: 126

Answers (1)

haris
haris

Reputation: 152

Try

combo1 = new QComboBox(ui->tableWidget);

Upvotes: 1

Related Questions