July 25, 2010

alex.barakhtyan alex.barakht..
Lab Rat
1 posts

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

5 replies

December 5, 2010

xsacha xsacha
Lab Rat
517 posts

I’m in favour of this. Bump. I wrote an app recently where I needed to subclass Widget with:

  1. void dragEnterEvent(QDragEnterEvent *event);
  2. void dragLeaveEvent(QDragLeaveEvent *event);
  3. void dragMoveEvent(QDragMoveEvent *event);
  4. void dropEvent(QDropEvent *event);

Don’t see why these can’t be included.

 Signature 

- Sacha

December 5, 2010

Gerolf Gerolf
Area 51 Engineer
3210 posts

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.

 Signature 

Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

December 5, 2010

Denis Kormalev Denis Kormalev
Lab Rat
1654 posts

Gerolf, I guess you are talking about promoting widgets (at least it is the name of the operation in Qt Creator).

December 5, 2010

Gerolf Gerolf
Area 51 Engineer
3210 posts

Denis, thats exactly what I meant. I just looked into QtDesigner, and didn’t find how to switch designer to english, it speaks german to me :-)

 Signature 

Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

December 6, 2010

infoctopus infoctopus
Lab Rat
120 posts

Also event filters can be of use, if you don’t want to subclass a widget for some reason

 Signature 

Qt rulez

 
  ‹‹ A place to find out answers to problem (stackoverflow)      undefined reference to `qBadAlloc()’ all over the place ››

You must log in to post a reply. Not a member yet? Register here!