Qt ─ how to use enum as the QMimeData type/format

Marek Kochanowicz sirherrbatka at gmail.com
Mon Feb 3 14:16:49 GMT 2014


I have to admit, that I have some problems understanding the QtMetaTypes 
system. If I clearly misunderstood whole thing, please point this out.

I need to create QMimeData subclass to store reference to some object. This 
object is of the concrete class, but can be of different semantics, depending 
on the enum member value. Therefore to accept drag I need to set the correct 
format of the QMimeData, depending on the said member enum value.

However, I don't know how I need to register those types to use with 
QMimeData. I guess I can't simply convert enum to string (yes, I have method 
in the class to do that) and create new format in the QMimeData during 
initialization based on that string.

What is the proper way to deal with this issue?
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.

More information about the kde mailing list