PDA

View Full Version : Drag and drop grid?



MrGarbage
30th August 2007, 17:44
Hi,

I am looking for the experts suggestions on how to best approach this
implementation. I have a custom LED widget. This will be arranged in
a grid as shown in the attached image. Using the left mouse click I
want to be able to grab the Green LED widget and drag it to one of the
other LED cells who would then turn Green.

It would be nice to have the LEDs use some sort of existing containerism
so that I can identify the drag destination without having to write too
much position calculation/object identification code.

Perhaps there is an applicable QT mechanism already in place?

Many thanks!

Mark

wysota
30th August 2007, 18:22
Take a look at drag&drop documentation. You'll need to reimplement mouseMoveEvent (and possibly mousePressEvent), dragEnterEvent and dropEvent for your LED widget.