Results 1 to 2 of 2

Thread: Drag and Drop - rejection in dropMimeData

  1. #1
    Join Date
    Apr 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Drag and Drop - rejection in dropMimeData

    Hi,

    I'm on 4.7 and am dropping data onto a subclass of standarditemmodel using dropMimeData; I can identify if I wish to reject the data, but when I do, it is gone from its original location.
    I can't stop the item being dragged, as it could go to a valid location. I detect an invalid drop by examining the contents of the item's data (a stored pointer to a class; I use the class type) and that of the target.
    How can I reject a drop and either leave the dragged item in place, or put it back where it was?

    Many thanks in advance!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Drag and Drop - rejection in dropMimeData

    In my opinion you have to do it in the view by intercepting drag and drop events. The current model API does not expose any functions to determine whether a particular drag is going to be accepted by the model or not. I even posted a bug report on it but it was a couple of years ago and then haven't fixed it (so it probably won't ever get fixed, at least not before Qt 6).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 2
    Last Post: 30th January 2014, 06:46
  2. Replies: 0
    Last Post: 7th January 2012, 15:20
  3. Replies: 2
    Last Post: 13th October 2010, 21:51
  4. Replies: 3
    Last Post: 10th June 2010, 15:13
  5. Replies: 0
    Last Post: 4th May 2010, 10:24

Tags for this Thread

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.