mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-09 21:24:36 +00:00
Prioritize dialog: fix drag-n-drop putting items before the last item
When the items in the prioritizations list were drag-n-dropped to the empty space, the row was equal to -1 and the dropped items ended up being moved to the position before the last item. Fixing the row value helps to avoid that behavior. Signed-off-by: Sergey Zhuravlevich <sergey@zhur.xyz>
This commit is contained in:
parent
116ac18e13
commit
b5a3313f80
@ -47,6 +47,12 @@ class PrioritizationList(ListviewModel):
|
|||||||
# to know where the drop took place.
|
# to know where the drop took place.
|
||||||
if parentIndex.isValid():
|
if parentIndex.isValid():
|
||||||
return False
|
return False
|
||||||
|
# "When row and column are -1 it means that the dropped data should be considered as
|
||||||
|
# dropped directly on parent."
|
||||||
|
# Moving items to row -1 would put them before the last item. Fix the row to drop the
|
||||||
|
# dragged items after the last item.
|
||||||
|
if row < 0:
|
||||||
|
row = len(self.model) - 1
|
||||||
strMimeData = bytes(mimeData.data(MIME_INDEXES)).decode()
|
strMimeData = bytes(mimeData.data(MIME_INDEXES)).decode()
|
||||||
indexes = list(map(int, strMimeData.split(",")))
|
indexes = list(map(int, strMimeData.split(",")))
|
||||||
self.model.move_indexes(indexes, row)
|
self.model.move_indexes(indexes, row)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user