Insert into the QTableWidget following kind of items:
QTableWidgetItem *item = new QTableWidgetItem();
item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
Works fine!
EDIT:
QTableWidgetItem *item = new QTableWidgetItem();
item->setFlags(item->flags() ^ Qt::ItemIsEditable);
This is a better solution. Thanks to @priomsrb.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…