AmirH
AmirH

Reputation: 67

Drag Text from an item of QListWidget to QLabel

I'm looking for the simpliest way, using Qt Designer and a little code, to drag text from a QListWidget (apparently there are options of draggable content in Qt Designer) to a QLabel (but I can't find any droppable action option ...) so its text is set to the text of the item we dragged. Any ideas ?

[C++, Windows, Qt5]

Upvotes: 0

Views: 274

Answers (1)

MasterAler
MasterAler

Reputation: 1653

Well, yeah, the most straightforward idea is subclassing QLabel and reimplementing it's

void dropEvent(QDropEvent* event)

QDrag object will help you pass text from QListWidget via it's mimeData, just create one in mouse event handler.

Check similar questions or examples for more information.

Upvotes: 1

Related Questions