QStandardItem custom drag MIME
-
I'm desperately trying to figure out how I can set custom data MIME type and data on a
QStandardItem. I would have expected thatQStandardItemprovides something similar toQStandardItem::setMimeData()which would allow to set the mime data (and type) for each individual item. However, that doesn't appear to be the case.What is the expected way of achieving this? I usually write my own models inheriting from
QAbstractItemModelbut the code I'm working on at the moment usesQStandardItemModel. Do I have to subclass it and re-implementQStandardItemModel::mimeData()? -
I'm desperately trying to figure out how I can set custom data MIME type and data on a
QStandardItem. I would have expected thatQStandardItemprovides something similar toQStandardItem::setMimeData()which would allow to set the mime data (and type) for each individual item. However, that doesn't appear to be the case.What is the expected way of achieving this? I usually write my own models inheriting from
QAbstractItemModelbut the code I'm working on at the moment usesQStandardItemModel. Do I have to subclass it and re-implementQStandardItemModel::mimeData()?Hi,
AFAIR, yes that's the way to do it.
-
Got it working that way (no surprise there).
However, I'd like to understand why
QStandardItemdoes not offer asetMimeData()function. Looking at the existing design ofQStandardItemModelandQStandardItemit seems feasible to implement this. Is this simply not implemented because nobody ever did it or is there a technical reason for this? -
@Joel-Bodenmann said in QStandardItem custom drag MIME:
However, I'd like to understand why QStandardItem does not offer a setMimeData() function.
Because noone wants to create a mime data just on suspicion for every item.