in my program, moving items between QListWidgets is used. The process itself, as I understand it, does not require code and it is enough to configure objects in the UI. but I need to perform an operation with transferred items, for this, as I understood it, I need to override the dropEvent function (QDropEvent * event);

actually what I did, at the same time redefining a couple more

protected: void dragEnterEvent(QDragEnterEvent *event); void dragMoveEvent(QDragMoveEvent *event); void dropEvent(QDropEvent *event); 

the problem is that none of them are ever called. What have I done wrong?

and I also observe the strange work of transferring objects: according to the task I need to transfer objects in batches and not one by one. For this, I set the selectionMode parameter in MultiSelection for all widgets, and click on the desired one with crl clamped. then when I chose the ones that need to be transferred, I click on any of the selected ones and transfer them to another widget, so when I click on an object which selection is already selected from it for some reason.

and if I start moving immediately after clicking on the latter without releasing the mouse, the objects will be copied and not moved

although everything works fine if you select objects just by clicking the mouse, without pressing crl, again, I need to transfer objects immediately after clicking on the latter

Looking for options to fix it.

  • try using ExtendedSelection. Regarding copying objects, try changing the values ​​of the property defaultDropAction - Alexander
  • ExtendedSelection did nothing except to forbid picking packs with the mouse. and yes, I forgot to mention that all widgets have defaultDropAction set to MoveAction - John Doe
  • Specify, are you trying to make a dnd between multiple widgets, or within one? - Bearded Beaver
  • multiple qlistwidget - John Doe
  • I need to update the moved entry in the database. - John Doe

0