문제

In PyQt how can I force a QTableWidget to only accept a single section (so that you can't select more items with Shift or crtl)?

도움이 되었습니까?

해결책

You need to call QAbstractItemBiew.setSelectionMode() or your QTableWidget with the appropriate SelectionBehavior, in your case QAbstractItemView.SingleSelection.

So something along the lines of:

myTable = QtGui.QTableWidget()
myTable.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top