PyMimeData#

class glue_qt.utils.PyMimeData(instance=None, **kwargs)#

Bases: QMimeData

A custom MimeData object that stores live python objects

Associate specific objects with a mime type by passing mime type / object key/value pairs to the __init__ method

If a single object is passed to the init method, that object is associated with the PyMimeData.MIME_TYPE mime type

Parameters:

instance – The python object to store

kwargs: Optional mime type / objects pairs to store as objects

Attributes Summary

MIME_TYPE

Methods Summary

data(mime_type)

Retrieve the data stored at the specified mime_type

formats(self)

hasFormat(self, mimetype)

setData(self, mimetype, data)

Attributes Documentation

MIME_TYPE = 'application/py_instance'#

Methods Documentation

data(mime_type)#

Retrieve the data stored at the specified mime_type

If mime_type is application/py_instance, a python object is returned. Otherwise, a QtCore.QByteArray is returned

formats(self) List[str]#
hasFormat(self, mimetype: str) bool#
setData(self, mimetype: str, data: QByteArray | bytes | bytearray)#