PDA

View Full Version : Icon Change in Drag & Drop



joseph
4th December 2006, 11:43
Dear all,

Qt version : Qt 3.3.4
Problem : Drag & Drop Event handling

I have a class " MyToolButton " inherited from QToolButton.
I have created 4 puttons like this and placed this 4 buttons in a QMainWindow's ToolBar ( MyToolBar ---> QToolBar ).

I need to drag the 1 button to a canvas, via the surface of other 3 tool buttons.
While draging a button like this ( via on surface of other 3 Tool Buttons ) i need to change the icon (which is attached to POINTER/ARROW_CURSOR ) to a Circle_And_Slash_Icon ( overridden cursor ).


I have used the " setAcceptDrops( true ) " in " MyToolButton " - Class , then tried to handle the dragEventHandles likes : mousePressEvent(), dragEnterEvent(), dragMoveEvent(), dragDropEvent()...But its not is not serving my purpose. as all the 4 buttons belogs to same class.



My problem is only in these 4 buttons. Please help me if you have any idea or correct me if have coded in a wrong way.

Thank you.

wysota
9th December 2006, 13:03
How did you implement dragEnterEvent and dragMoveEvent?