Here is a simple trick to sort number columns in the QTableWidget of Qt4 and PyQt4: Format the number as a right aligned string:
for i range(12): item = QTableWidgetItem(u'%7d' random.randint(1, 10000)) item.setTextAlignment(Qt.AlignRight) table.setItem (i, 1, item)
No comments:
Post a Comment