How to make a column in QTableWidget read only?
问题 I would like to have one column in QTableWidget NOT editable. In forums I have read a lot about some flags but could not manage to implement. 回答1: 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. 回答2: The result of using