|
|
#1 |
|
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46
Karma: 39844
Join Date: Jan 2026
Device: Samsung Galaxy Tab S10 Lite
|
Drag and Drop
Hello,
What is the trick to getting drag and drop in a list to stick? This is the code I am using: self.challenge_list.setDragDropMode(self.challenge _list.InternalMove) I can move but everything reverts after refreshing/restarting. Thanks. Last edited by varia; 03-14-2026 at 01:20 PM. |
|
|
|
|
|
#2 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,070
Karma: 1084520
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite
|
Check
Code:
self.challenge_list.setDragDropMode(QAbstractItemView.InternalMove)
self.challenge_list.setDefaultDropAction(Qt.MoveAction)
class ChallengeList(QListWidget):
def dropEvent(self, event):
super().dropEvent(event)
# Capture the new order
order = [self.item(i).text() for i in range(self.count())]
print("New order:", order)
# Save 'order' to your config or model here
|
|
|
|
|
|
#3 |
|
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46
Karma: 39844
Join Date: Jan 2026
Device: Samsung Galaxy Tab S10 Lite
|
Thanks Dunhill. Hopefully now I'm on track. Now just need to iron out some buginess with drag/drop in general.
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Drag and drop text in 2.0.0 | StephV | Sigil | 35 | 09-10-2023 11:52 AM |
| No more Drag and Drop? | hard_boiled | Library Management | 14 | 09-29-2013 07:44 PM |
| Touch Drag and Drop fails. | edu500ac | Kobo Reader | 8 | 09-25-2012 05:28 AM |
| Drag 'n' Drop | Perkin | Calibre | 17 | 10-06-2010 11:46 AM |
| Drag and Drop | jjjconnon | Calibre | 11 | 02-27-2010 11:59 PM |