Results 1 to 7 of 7

Thread: Itemview D&D mimeData

  1. #1
    Join Date
    Feb 2009
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Itemview D&D mimeData

    I have and QTableView that I have set to allow drag and drops. I implemented these three methods in the model: mimeTypes, mimeData and dropMimeData. When I attempt to drag and item from my view and drop it in a different location within the same view, I can see that mimeTypes is called and dropMimeData is called, but I do not see when mimeData is called. Isn't the QTableView supposed to automatically call mimeData? I really do not want to subclass the QTableView if I don't have to.

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

    Default Re: Itemview D&D mimeData

    mimeData is used for dragging, not dropping. It will be called earlier in the sequence.
    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.


  3. #3
    Join Date
    Feb 2009
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Itemview D&D mimeData

    I put a print in my mimeData and the other methods and did not see it called. That is why I am confused about it. I knew it was used for dragging (exporting the data into the QMimeData).

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

    Default Re: Itemview D&D mimeData

    Maybe the prototype of the method is incorrect? Double check the const keywords, etc.
    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.


  5. #5
    Join Date
    Feb 2009
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Itemview D&D mimeData

    Thanks, I got that working. I fat-fingered something else, so that it wasn't called.

    Has anyone seen any problems with a seg fault when dropping an item into the table view (not specifically on an item in the view)?

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

    Default Re: Itemview D&D mimeData

    Even if I answer "yes" here, it won't help you much as the number of different thing causing a segmentation fault can be huge. It'd be better if you provided a backtrace from the debugger and/or contents of your dropMimeData method.
    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.


  7. #7
    Join Date
    Feb 2009
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Itemview D&D mimeData

    Thanks anyway. I have to do the flags correctly and handle it when dropping onto the blank space in the view.

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.