PythonQt.QtCore.QMimeData · declarations 001
Back to PythonQt.QtCore.QMimeData
clear
clear() -> None
X.clear()
Supplemental documentation: Qt 5 reference:
void QMimeData::clear()
Removes all the MIME type and data entries in the object.
Upstream PySide2 reference signatures (binding differences may apply):
clear(self) -> None
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#clear
colorData
colorData() -> Any
X.colorData() -> object
Supplemental documentation: Qt 5 reference:
QVariant QMimeData::colorData() const
Returns a color if the data stored in the object represents a color (MIME type
application/x-color); otherwise returns a null variant.
A QVariant is used because QMimeData belongs to the Qt Core module, whereas QColor belongs to Qt GUI. To convert the QVariant to a QColor, simply use qvariant_cast(). For example:
if (event->mimeData()->hasColor()) {
QColor color = qvariant_cast<QColor>(event->mimeData()->colorData());
...
}
See also hasColor(), setColorData(), and data().
Upstream PySide2 reference signatures (binding differences may apply):
colorData(self) -> typing.Any
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#colorData
data
data(mimetype: str) -> Any
X.data(mimetype) -> PythonQt.QtCore.QByteArray
Supplemental documentation: Qt 5 reference:
QByteArray QMimeData::data(const QString \&mimeType) const
Returns the data stored in the object in the format described by the MIME type specified by mimeType.
See also setData().
Upstream PySide2 reference signatures (binding differences may apply):
data(self, mimetype: str) -> PySide2.QtCore.QByteArray
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#data
destroyed
destroyed(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtCore.QMimeData.destroyed; argument details are not documented.
formats
formats() -> tuple
X.formats() -> tuple
Supplemental documentation: Qt 5 reference:
[virtual] QStringList QMimeData::formats() const
Returns a list of formats supported by the object. This is a list of MIME types for which the object can return suitable data. The formats in the list are in a priority order.
For the most common types of data, you can call the higher-level functions hasText(), hasHtml(), hasUrls(), hasImage(), and hasColor() instead.
See also hasFormat(), setData(), and data().
Upstream PySide2 reference signatures (binding differences may apply):
formats(self) -> typing.List[str]
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#formats
hasColor
hasColor() -> bool
X.hasColor() -> bool
Supplemental documentation: Qt 5 reference:
bool QMimeData::hasColor() const
Returns true if the object can return a color (MIME type application/x-color);
otherwise returns false.
See also setColorData(), colorData(), and hasFormat().
Upstream PySide2 reference signatures (binding differences may apply):
hasColor(self) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#hasColor
hasFormat
hasFormat(mimetype: str) -> bool
X.hasFormat(mimetype) -> bool
Supplemental documentation: Qt 5 reference:
[virtual] bool QMimeData::hasFormat(const QString \&mimeType) const
Returns true if the object can return data for the MIME type specified by mimeType;
otherwise returns false.
For the most common types of data, you can call the higher-level functions hasText(), hasHtml(), hasUrls(), hasImage(), and hasColor() instead.
See also formats(), setData(), and data().
Upstream PySide2 reference signatures (binding differences may apply):
hasFormat(self, mimetype: str) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#hasFormat
hasHtml
hasHtml() -> bool
X.hasHtml() -> bool
Supplemental documentation: Qt 5 reference:
bool QMimeData::hasHtml() const
Returns true if the object can return HTML (MIME type text/html); otherwise returns
false.
See also setHtml(), html(), and hasFormat().
Upstream PySide2 reference signatures (binding differences may apply):
hasHtml(self) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#hasHtml
hasImage
hasImage() -> bool
X.hasImage() -> bool
Supplemental documentation: Qt 5 reference:
bool QMimeData::hasImage() const
Returns true if the object can return an image; otherwise returns false.
See also setImageData(), imageData(), and hasFormat().
Upstream PySide2 reference signatures (binding differences may apply):
hasImage(self) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#hasImage
hasText
hasText() -> bool
X.hasText() -> bool
Supplemental documentation: Qt 5 reference:
bool QMimeData::hasText() const
Returns true if the object can return plain text (MIME type text/plain); otherwise
returns false.
See also setText(), text(), hasHtml(), and hasFormat().
Upstream PySide2 reference signatures (binding differences may apply):
hasText(self) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#hasText
hasUrls
hasUrls() -> bool
X.hasUrls() -> bool
Supplemental documentation: Qt 5 reference:
bool QMimeData::hasUrls() const
Returns true if the object can return a list of urls; otherwise returns false.
URLs correspond to the MIME type text/uri-list.
See also setUrls(), urls(), and hasFormat().
Upstream PySide2 reference signatures (binding differences may apply):
hasUrls(self) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#hasUrls
html
html() -> str
X.html() -> str
Supplemental documentation: Qt 5 reference:
QString QMimeData::html() const
Returns a string if the data stored in the object is HTML (MIME type text/html);
otherwise returns an empty string.
See also setHtml(), hasHtml(), and setData().
Upstream PySide2 reference signatures (binding differences may apply):
html(self) -> str
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#html
imageData
imageData() -> Any
X.imageData() -> object
Supplemental documentation: Qt 5 reference:
QVariant QMimeData::imageData() const
Returns a QVariant storing a QImage if the object can return an image; otherwise returns a null variant.
A QVariant is used because QMimeData belongs to the Qt Core module, whereas QImage belongs to Qt GUI. To convert the QVariant to a QImage, simply use qvariant_cast(). For example:
if (event->mimeData()->hasImage()) {
QImage image = qvariant_cast<QImage>(event->mimeData()->imageData());
...
}
See also setImageData() and hasImage().
Upstream PySide2 reference signatures (binding differences may apply):
imageData(self) -> typing.Any
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#imageData
objectNameChanged
objectNameChanged(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtCore.QMimeData.objectNameChanged; argument details are not documented.
removeFormat
removeFormat(mimetype: str) -> None
X.removeFormat(mimetype)
Supplemental documentation: Qt 5 reference:
void QMimeData::removeFormat(const QString \&mimeType)
Removes the data entry for mimeType in the object.
This function was introduced in Qt 4.4.
Upstream PySide2 reference signatures (binding differences may apply):
removeFormat(self, mimetype: str) -> None
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#removeFormat
retrieveData
retrieveData(mimetype: str, preferredType: Any) -> Any
X.retrieveData(mimetype, preferredType) -> object
Supplemental documentation: Qt 5 reference:
[virtual protected] QVariant QMimeData::retrieveData(const QString \&mimeType, QVariant::Type type) const
Returns a variant with the given type containing data for the MIME type specified by mimeType. If the object does not support the MIME type or variant type given, a null variant is returned instead.
This function is called by the general data() getter and by the convenience getters (text(), html(), urls(), imageData(), and colorData()). You can reimplement it if you want to store your data using a custom data structure (instead of a QByteArray, which is what setData() provides). You would then also need to reimplement hasFormat() and formats().
See also data().
Upstream PySide2 reference signatures (binding differences may apply):
retrieveData(self, mimetype: str, preferredType: type) -> typing.Any
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#retrieveData
setColorData
setColorData(color: Any) -> None
X.setColorData(color)
Supplemental documentation: Qt 5 reference:
void QMimeData::setColorData(const QVariant \&color)
Sets the color data in the object to the given color.
Colors correspond to the MIME type application/x-color.
See also colorData(), hasColor(), and setData().
Upstream PySide2 reference signatures (binding differences may apply):
setColorData(self, color: typing.Any) -> None
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#setColorData
setData
setData(mimetype: str, data: Any) -> None
X.setData(mimetype, data)
Supplemental documentation: Qt 5 reference:
void QMimeData::setData(const QString \&mimeType, const QByteArray \&data)
Sets the data associated with the MIME type given by mimeType to the specified data.
For the most common types of data, you can call the higher-level functions setText(), setHtml(), setUrls(), setImageData(), and setColorData() instead.
Note that if you want to use a custom data type in an item view drag and drop operation, you must register it as a Qt meta type, using the Q_DECLARE_METATYPE() macro, and implement stream operators for it. The stream operators must then be registered with the qRegisterMetaTypeStreamOperators() function.
See also data(), hasFormat(), QMetaType, and qRegisterMetaTypeStreamOperators().
Upstream PySide2 reference signatures (binding differences may apply):
setData(self, mimetype: str, data: PySide2.QtCore.QByteArray) -> None
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#setData
setHtml
setHtml(html: str) -> None
X.setHtml(html)
Supplemental documentation: Qt 5 reference:
void QMimeData::setHtml(const QString \&html)
Sets html as the HTML (MIME type text/html) used to represent the data.
See also html(), hasHtml(), setText(), and setData().
Upstream PySide2 reference signatures (binding differences may apply):
setHtml(self, html: str) -> None
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#setHtml
setImageData
setImageData(image: Any) -> None
X.setImageData(image)
Supplemental documentation: Qt 5 reference:
void QMimeData::setImageData(const QVariant \&image)
Sets the data in the object to the given image.
A QVariant is used because QMimeData belongs to the Qt Core module, whereas QImage belongs to Qt GUI. The conversion from QImage to QVariant is implicit. For example:
mimeData->setImageData(QImage("beautifulfjord.png"));
See also imageData(), hasImage(), and setData().
Upstream PySide2 reference signatures (binding differences may apply):
setImageData(self, image: typing.Any) -> None
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#setImageData
setText
setText(text: str) -> None
X.setText(text)
Supplemental documentation: Qt 5 reference:
void QMimeData::setText(const QString \&text)
Sets text as the plain text (MIME type text/plain) used to represent the data.
See also text(), hasText(), setHtml(), and setData().
Upstream PySide2 reference signatures (binding differences may apply):
setText(self, text: str) -> None
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#setText
setUrls
setUrls(urls: Any) -> None
X.setUrls(urls)
Supplemental documentation: Qt 5 reference:
void QMimeData::setUrls(const QList\<QUrl> \&urls)
Sets the URLs stored in the MIME data object to those specified by urls.
URLs correspond to the MIME type text/uri-list.
Since Qt 5.0, setUrls also exports the urls as plain text, if setText was not called before, to make it possible to drop them into any lineedit and text editor.
See also urls(), hasUrls(), and setData().
Upstream PySide2 reference signatures (binding differences may apply):
setUrls(self, urls: typing.Sequence[PySide2.QtCore.QUrl]) -> None
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#setUrls
text
text() -> str
X.text() -> str
Supplemental documentation: Qt 5 reference:
QString QMimeData::text() const
Returns a plain text (MIME type text/plain) representation of the data.
See also setText(), hasText(), html(), and data().
Upstream PySide2 reference signatures (binding differences may apply):
text(self) -> str
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#text
urls
urls() -> tuple
X.urls() -> tuple
Supplemental documentation: Qt 5 reference:
QList\<QUrl> QMimeData::urls() const
Returns a list of URLs contained within the MIME data object.
URLs correspond to the MIME type text/uri-list.
See also setUrls(), hasUrls(), and data().
Upstream PySide2 reference signatures (binding differences may apply):
urls(self) -> typing.List[PySide2.QtCore.QUrl]
Source: https://doc.qt.io/archives/qt-5.15/qmimedata.html#urls