Implemented sorting by track title, artist name etc...

(Sorting order is not getting saved.)
This commit is contained in:
The Wobbler 2025-02-23 16:38:56 +01:00
parent 1b69321c05
commit 3dd9123332
3 changed files with 100 additions and 21 deletions

View file

@ -18,6 +18,7 @@ class TrackItem(QTreeWidgetItem):
self.track = track
self.index_user_sort = index
self.index = index
self.parent = parent
self.playlist = parent.playlist
@ -48,10 +49,20 @@ class TrackItem(QTreeWidgetItem):
self.setFont(2, self.bold_font)
self.setFont(3, self.normal_font)
def unmark(self):
self.setIcon(0, QIcon(None))
self.setFont(1, self.normal_font)
self.setFont(2, self.normal_font)
self.setFont(3, self.normal_font)
def __lt__(self, other):
# make numeric strings get sorted the right way
column = self.parent.sortColumn()
if column == 0 or column == 4:
return int(self.text(column)) < int(other.text(column))
else:
return super().__lt__(other)