Move setSortingEnabled to the widget init rather than after setting the data, otherwise weird sorting happens

This commit is contained in:
Brianna Laugher 2013-03-05 16:29:07 +11:00
parent cba720730d
commit e4314f883d

View File

@ -27,6 +27,7 @@ class TableWidget(QtGui.QTableWidget):
self.setVerticalScrollMode(self.ScrollPerPixel)
self.setSelectionMode(QtGui.QAbstractItemView.ContiguousSelection)
self.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
self.setSortingEnabled(True)
self.clear()
self.contextMenu = QtGui.QMenu()
self.contextMenu.addAction('Copy Selection').triggered.connect(self.copySel)
@ -45,7 +46,6 @@ class TableWidget(QtGui.QTableWidget):
def setData(self, data):
self.clear()
self.appendData(data)
self.setSortingEnabled(True)
self.resizeColumnsToContents()
def appendData(self, data):