Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Drag & Drop Question: "Accessing QMimeData directly"
QtWS25 Last Chance

Drag & Drop Question: "Accessing QMimeData directly"

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 319 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ModelTechM Offline
    ModelTechM Offline
    ModelTech
    wrote on last edited by
    #1

    I am implementing some drag and drop functionality for which I created a QMimeData subclass that has a pointer attribute to some self defined object. So far, I have been able to get things working up to retrieving this attribute back from my QMimeData class. I have looked at the 3rd approach explained over here on passing custom data for a drag event: http://doc.qt.io/qt-5/qmimedata.html My problem is that I do not understand what "// access myData's data directly (not through QMimeData's API)" means in this example. I cannot use myData->myFunctionToAccessTheData() which is implemented to return the pointer I need. The problem originates from the const in the cast "qobject_cast<const MyMimeData *>(event->mimeData());". Any ideas how to go around this?

    1 Reply Last reply
    0
    • ModelTechM Offline
      ModelTechM Offline
      ModelTech
      wrote on last edited by
      #2

      I got it to work with a const_cast ...

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved