qt禁止编辑tableWidget

1
2
3
4
QTableWidgetItem* pItem = ui->tableWidget->item(i, 1);
pItem->setFlags(pItem->flags() & (~Qt::ItemIsEditable));
pItem = ui->tableWidget->item(i, 2);
pItem->setFlags(pItem->flags() & (~Qt::ItemIsEditable));