开发者

How to disable Edit mode in the QTableView?

开发者 https://www.devze.com 2023-01-18 15:23 出处:网络
I am using QTableView. It\'s working fine. But the problem is 开发者_开发技巧that if I double click the cell then it changes into edit mode. I need to disable the edit option. How to do that?Use the f

I am using QTableView. It's working fine. But the problem is 开发者_开发技巧that if I double click the cell then it changes into edit mode. I need to disable the edit option. How to do that?


Use the following:

QTableView table(...);
table.setEditTriggers(QAbstractItemView::NoEditTriggers);


Try QAbstractItemView, which is the baseclass of QTableView where the EditTriggers enum (which NoEdittriggers is an element of) is declared. Taken from this link.

QTableView table(...);
table.setEditTriggers(QAbstractItemView::NoEditTriggers);


Use the editTriggers property to change the behaviour. All possible values are described here.

QTableView view();
view.setEditTriggers(QAbstractItemView::NoEditTriggers);
0

精彩评论

暂无评论...
验证码 换一张
取 消