1

I have a GUI application with a QListWidget that contain QCheckBox's. The QListWidget has the option InternalMove dragDropMode activated. I am having some issues with some 'out of ordinary' use of the drag-drop utility.

It looks like this:

enter image description here


The behavior is all correct, except when I try to drag-drop an item over 'itself'. If I try to drop the item 'B' between 'A' and 'B', nothing happens, which is what I would expect. However, if I try to drop 'B' between 'B' and 'C'. The widget of item 'B' just disappears, but the 'blank' line is still drag-drop'able, which I did not expect. Any idea why would this happen?

enter image description here


enter image description here

Oier Arcelus
  • 107
  • 1
  • 8
  • 1
    I suppose that you actually used `setItemWidget()`. There's no need for that, instead use [`item.setCheckState()`](https://doc.qt.io/qt-5/qlistwidgetitem.html#setCheckState) (with `Qt.Unchecked`) which automatically makes the list item *visibly* checkable. If you want a more descriptive answer, please provide a [mre]. – musicamante Jun 07 '22 at 10:40
  • Such a simple option. Works perfectly! Thanks! – Oier Arcelus Jun 07 '22 at 10:51
  • I have the exact same issue, but I can't use setCheckState because I have 2 checkboxes and a button in my widget. – PaddleStroke Mar 24 '23 at 08:58

0 Answers0