checkboxMapper = new QSignalMapper(this);
To copy to clipboard, switch view to plain text mode
ui->table->setRowCount(ui->table->rowCount()+1);
int index = ui->table->rowCount()-1;
new_checkbox->setChecked(true);
connect(new_checkbox,SIGNAL(toggled(bool)),checkboxMapper,SLOT(map(bool)));
checkboxMapper->setMapping(new_checkbox,(index,new_checkbox->isChecked()));
connect(checkboxMapper,SIGNAL(mapped(int,bool)),this,SLOT(checkbox_toggled(int,bool)));
ui->table->setCellWidget(index,1,new_checkbox);
ui->table->setRowCount(ui->table->rowCount()+1);
int index = ui->table->rowCount()-1;
QCheckBox *new_checkbox = new QCheckBox(this);
new_checkbox->setChecked(true);
connect(new_checkbox,SIGNAL(toggled(bool)),checkboxMapper,SLOT(map(bool)));
checkboxMapper->setMapping(new_checkbox,(index,new_checkbox->isChecked()));
connect(checkboxMapper,SIGNAL(mapped(int,bool)),this,SLOT(checkbox_toggled(int,bool)));
ui->table->setItem(index,0,new QTableWidgetItem("Some Stuff"));
ui->table->setCellWidget(index,1,new_checkbox);
To copy to clipboard, switch view to plain text mode
Bookmarks