How to create dynamic drag and drop functionality
-
Hi @ketaki,
Yes that's already natively supported in QWidget.Some UI element are already implementing drag & drop, like QTableWidget for example.
But if you want to make your own widget with drag and drop, what you have to do is:
- Calling
setAcceptDrops(true);
(usually in the widget's constructor) for accepting drops - Re-implement dropEvent() and dragEnterEvent()
See the documentation for more details: https://doc.qt.io/qt-5/dnd.html
- Calling
-
@ketaki said in How to create dynamic drag and drop functionality:
Is this possible using PyQt5 designer?
Designer is used to design the UI. You still have to write code for the actual functionality.
Please read the documentation (@Gojir4 gave you the link). -
@ketaki said in How to create dynamic drag and drop functionality:
Is QT supports that?
What exactly?
Drag and drop? Yes, it does, just read the link... -
@ketaki Qt is full of examples: https://doc.qt.io/qt-5/qtexamplesandtutorials.html
-
@ketaki
What about you reading through the documentation link you have been given? What about, say, the Draggable Icons Example referenced there?