편집 불가 로 QTableWidget 설정

1159 단어 Qt
1.프로 그래 밍 에서 QTableWidget 을 편집 불가 로 설정 하려 면 다음 코드 를 사용 하면 됩 니 다.
setEditTriggers(QAbstractItemView::NoEditTriggers);

2 QTableWidget 에서 설명:
   QTableWidget 은 QAbstractItemView 에서 계승 되 며,QAbstractItemView 방법 setEditTriggers 는 편집 이 가능 한 지 여 부 를 설정 할 수 있 기 때문에 QAbstractItemView 에서 계승 하 는 다른 종류의 컨트롤 은 편집 가능 여부 로 설정 할 수 있 으 며,방법 은 1 과 같 습 니 다.
QAbstractItemView 의 편집 트리거 이 벤트 는 다음 과 같 습 니 다.
Constant
Value
Description
QAbstractItemView::NoEditTriggers
0
No editing possible.
QAbstractItemView::CurrentChanged
1
Editing start whenever current item changes.
QAbstractItemView::DoubleClicked
2
Editing starts when an item is double clicked.
QAbstractItemView::SelectedClicked
4
Editing starts when clicking on an already selected item.
QAbstractItemView::EditKeyPressed
8
Editing starts when the platform edit key has been pressed over an item.
QAbstractItemView::AnyKeyPressed
16
Editing starts when any key is pressed over an item.
QAbstractItemView::AllEditTriggers
31
Editing starts for all above actions.

좋은 웹페이지 즐겨찾기