Results 1 to 2 of 2

Thread: drag and drop QToolButton in QToolBar

  1. #1
    Join Date
    Dec 2008
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default drag and drop QToolButton in QToolBar

    Hello,

    I am trying to do a Drag and Drop of a QToolButton in the same QToolBar. It's working but I have some problems:

    - QDragLeaveEvent:
    This method is supposed to be called when the drag go out of the toolbar, but it's called two when the drag is on a child of the toolbar (one of the others QToolButton).
    How to solve this problems ?
    I tried to overwrite dragEnterEvent for all the buttons:
    Qt Code:
    1. void dragEnterEvent(QDragEnterEvent *event)
    2. {
    3. event->ignore();
    4. }
    To copy to clipboard, switch view to plain text mode 
    but this is not working.

    - dropEvent:
    dropEvent is called only if a drop occure inside the toolbar. How to detect a drop outside the toolbar ?

    - Drag interruption:
    How to interrupt a drag ? to start the drag I use drag->start(), but If I want to end the drag when the mouse is outside the widget, how can I do that ? I need something like drag->end().

    Thank you

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: drag and drop QToolButton in QToolBar

    Perhaps it would be easier to do it within mouse event handlers instead of drag and drop?
    J-P Nurmi

Similar Threads

  1. Drag and Drop QTableWidget in UI file.
    By tpf80 in forum Qt Programming
    Replies: 3
    Last Post: 21st January 2009, 00:02
  2. Change cursor & status during Drag & Drop
    By ronlongo in forum Qt Programming
    Replies: 0
    Last Post: 1st December 2008, 17:56
  3. Drag & Drop when parent and childs accept drops?
    By gri in forum Qt Programming
    Replies: 0
    Last Post: 17th October 2008, 10:00
  4. Replies: 7
    Last Post: 8th September 2006, 17:19
  5. Drag and drop revisited
    By Big Duck in forum Newbie
    Replies: 2
    Last Post: 30th June 2006, 17:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.