Results 1 to 20 of 21

Thread: Drag and drop between model views

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Drag and drop between model views

    I have to admit I didn't understand your post

    QDrag::start returns an information if the drag was accepted and with which action. If it was dropped on an invalid target, it will return IgnoreAction, if it was dropped on a valid target but the drop was rejected, it will return IgnoreAction. If it was dropped on a valid target and the target did something with the data (no matter if the target is in the same application as the source or if it's a completely different program), it will return an action telling you what should you do with the data -- copy, move, link or ignore it. If you drop on Firefox and firefox accepts the drop, you'll receive CopyAction. So you'll always know what you should do with the item.

    Does that solve your problem? If you have doubts, please look at the puzzle example bundled with Qt and at the definition of the puzzle widget (or whatever it's called). The widget does the thing I think you want to do, just it doesn't use model-view, but the idea remains. If a drag is started, the item gets removed from the widget, if a valid drop occurs, the item gets inserted in a new position. If an invalid drop occurs, the item gets inserted back into the place it was taken from. No matter where you actually drop the item (and by using a custom MIME type it assures that you won't make a valid drop outside the puzzle application).

  2. The following 2 users say thank you to wysota for this useful post:

    larry104 (21st July 2006), Micawber (26th May 2008)

Similar Threads

  1. Drag & drop with model/view (Qt4)
    By yogeshm02 in forum Qt Programming
    Replies: 16
    Last Post: 19th September 2011, 20:36
  2. Drag and drop outside the application
    By jpn in forum Newbie
    Replies: 7
    Last Post: 27th August 2006, 15:37
  3. Drag and drop revisited
    By Big Duck in forum Newbie
    Replies: 2
    Last Post: 30th June 2006, 16:41
  4. drag and drop with item views
    By castorvert in forum Qt Programming
    Replies: 14
    Last Post: 27th March 2006, 10:12
  5. Drag 'n Drop problem
    By kiker99 in forum Qt Programming
    Replies: 4
    Last Post: 16th January 2006, 16:35

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
  •  
Qt is a trademark of The Qt Company.