class glue.utils.qt.PyMimeData(instance=None, **kwargs)

Bases: PyQt5.QtCore.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


instance – The python object to store

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

Attributes Summary


Methods Summary

data(self, mime_type)

Retrieve the data stored at the specified mime_type


hasFormat(self, fmt)

setData(self, str, Union[QByteArray, bytes, …)

Attributes Documentation

MIME_TYPE = 'application/py_instance'

Methods Documentation

data(self, 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

hasFormat(self, fmt)
setData(self, str, Union[QByteArray, bytes, bytearray])