That's not very elegant 
You may try:
myData = myStructObj.serialize(); // *
mimeData->setData("application/x-mystruct", myData);
QByteArray myData;
myData = myStructObj.serialize(); // *
QMimeData *mimeData = new QMimeData;
mimeData->setData("application/x-mystruct", myData);
To copy to clipboard, switch view to plain text mode
*) - you have to provide this operator yourself, for example using a QDataStream or something like that
For simple structures using a TSV or CSV is a nice way to go too. If you don't plan to drag the item out of your application, you can stick with pointers too. Just dragging your "int" to some text editor or something like that may provide weird results
Bookmarks