Drag and Drop implementation proposal
-
Dear collegues!
The problem: implementation of drag and drop requires subclassing of widget classes, so Designer becomes useless.
The proposed solution: implement drag and drop policy classes (with virtual methods like dragEnter, dragMove, dropEvent etc., even possibly shallIBeginDrag ), instances of subclasses of which can be set to widgets and other drag/drop sources/targets by setDragDropPolicy method.
What do you think? What is overall procedure of putting proposals to API?
Thanks in advance -
I'm in favour of this. Bump. I wrote an app recently where I needed to subclass Widget with:
@void dragEnterEvent(QDragEnterEvent *event);
void dragLeaveEvent(QDragLeaveEvent *event);
void dragMoveEvent(QDragMoveEvent *event);
void dropEvent(QDropEvent *event);@Don't see why these can't be included.
-
You can use user defined classes in designer. Just put the base class on the widget (e.g. a checkbox) and the add a custom class (right click on the widget --> Use as placeholder for user defined class).
Then you have a custom class in designer which you can implement in your source code. -
Gerolf, I guess you are talking about promoting widgets (at least it is the name of the operation in Qt Creator).
-
Also event filters can be of use, if you don't want to subclass a widget for some reason