我有数据行,并希望如下所示:
1
1a
1a2
2
3
9
9.9
10
10a
11
100
100ab
ab
aB
AB
Run Code Online (Sandbox Code Playgroud)
当我使用pyQt并且代码包含在TreeWidgetItem中时,我正在尝试解决的代码是:
def __lt__(self, otherItem):
column = self.treeWidget().sortColumn()
#return self.text(column).toLower() < otherItem.text(column).toLower()
orig = str(self.text(column).toLower()).rjust(20, "0")
other = str(otherItem.text(column).toLower()).rjust(20, "0")
return orig < other
Run Code Online (Sandbox Code Playgroud)