From 5f466691784708bf6eaaa53d5668163691c4b98c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 22 Jul 2024 11:00:38 -0700 Subject: [PATCH] QMimeData/Docs: include the fact that some functions may convert QMimeDataPrivate::retrieveTypedData() converts if the target MIME type is text/plain or if the target meta type is QByteArray. Fixes: QTBUG-127296 Change-Id: I4878533dcb2d4b3e8efefffd17e49ade9fbb32f8 Reviewed-by: David Faure (cherry picked from commit 05aaf2a684e49d6034f3860fb55a70e75de61e49) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/kernel/qmimedata.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qmimedata.cpp b/src/corelib/kernel/qmimedata.cpp index 2c0a89dbd7c..afbd2adcfed 100644 --- a/src/corelib/kernel/qmimedata.cpp +++ b/src/corelib/kernel/qmimedata.cpp @@ -374,8 +374,9 @@ bool QMimeData::hasUrls() const /*! - Returns a plain text (MIME type \c text/plain) representation of - the data. + Returns the plain text (MIME type \c text/plain) representation of + the data if this object contains plain text. If it contains some other + content, this function makes a best effort to convert it to plain text. \sa hasText(), html(), data() */ @@ -541,7 +542,11 @@ bool QMimeData::hasColor() const /*! Returns the data stored in the object in the format described by - the MIME type specified by \a mimeType. + the MIME type specified by \a mimeType. If this object does not contain + data for the \a mimeType MIME type (see hasFormat()), this function may + perform a best effort conversion to it. + + \sa hasFormat(), setData() */ QByteArray QMimeData::data(const QString &mimeType) const {