Unsolved QListWidget drag indicator not showing
-
Hello, I have a simple list widget, and have following drag drop settings:
setDragEnabled(true);
setIconSize(QSize(m_PieceSize, m_PieceSize));
setAcceptDrops(true);
setDropIndicatorShown(true);
setDefaultDropAction(Qt::MoveAction);But when drag an item and move inside list view, there is no drag indicator showing(no line/rectangle drawn on where dragging item will be dropped), what is the problem?
Thanks in advance.
-
@Leon-Zhang
Did you read through Using Drag and Drop with Item Views? Try the examples there, e.g. maybe you needlistWidget->setDragDropMode(QAbstractItemView::InternalMove);
or the other code shown there. -
@JonB Thanks for reply.
I have read this Using Drag and Drop with Item Views document carefully, but the method it metioned just not working.
I have changed code to follow:
setDragEnabled(true);
setAcceptDrops(true);
setDropIndicatorShown(true);
setDefaultDropAction(Qt::MoveAction);
this->setDragDropMode(QAbstractItemView::InternalMove);
this->viewport()->setAcceptDrops(true);But it still no change, when I drag item, I can see a black dot drawn on top left corner of list view:
But not fully drawn as line and rectangle which encapsulate list items.@JonB Is there any simple example project to showcase drag and drop indicator works?