Question

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)?

Was it helpful?

Solution

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)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top