Thread: Drag and Drop
View Single Post
Old 03-14-2026, 04:57 PM   #2
dunhill
Wizard
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 1,215
Karma: 1513034
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite, Linux Mint
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
dunhill is offline   Reply With Quote