Move setSortingEnabled to the widget init rather than after setting the data, otherwise weird sorting happens
This commit is contained in:
parent
cba720730d
commit
e4314f883d
@ -27,6 +27,7 @@ class TableWidget(QtGui.QTableWidget):
|
|||||||
self.setVerticalScrollMode(self.ScrollPerPixel)
|
self.setVerticalScrollMode(self.ScrollPerPixel)
|
||||||
self.setSelectionMode(QtGui.QAbstractItemView.ContiguousSelection)
|
self.setSelectionMode(QtGui.QAbstractItemView.ContiguousSelection)
|
||||||
self.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
|
self.setSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
|
||||||
|
self.setSortingEnabled(True)
|
||||||
self.clear()
|
self.clear()
|
||||||
self.contextMenu = QtGui.QMenu()
|
self.contextMenu = QtGui.QMenu()
|
||||||
self.contextMenu.addAction('Copy Selection').triggered.connect(self.copySel)
|
self.contextMenu.addAction('Copy Selection').triggered.connect(self.copySel)
|
||||||
@ -45,7 +46,6 @@ class TableWidget(QtGui.QTableWidget):
|
|||||||
def setData(self, data):
|
def setData(self, data):
|
||||||
self.clear()
|
self.clear()
|
||||||
self.appendData(data)
|
self.appendData(data)
|
||||||
self.setSortingEnabled(True)
|
|
||||||
self.resizeColumnsToContents()
|
self.resizeColumnsToContents()
|
||||||
|
|
||||||
def appendData(self, data):
|
def appendData(self, data):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user