Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
6.2.4
-
None
-
Qt 6.2.4, openSUSE Leap 15.3, gcc 11.2.1
-
-
46d047b76c (qt/qtbase/dev) 46d047b76c (qt/tqtc-qtbase/dev) bab62f68a4 (qt/tqtc-qtbase/6.2)
Description
Regression: Drag/drop of "text/plain" does not work, QMimeData::text() returns an empty string. This bug existed in Qt 5.15 and was fixed with QTBUG-84662. Citation from the commit message: "this is not needed for Qt 6 due to QTextCodec was replaced by QStringConverter".
Suggested fix in qmimedata.cpp (line 156):
if (data.metaType().id() == QMetaType::QByteArray) { // see if we can convert to the requested type switch (typeId) { case QMetaType::QString: { const QByteArray ba = data.toByteArray(); if (ba.isNull()) // <=============== return QVariant(); // <=============== not QString() if (format == QLatin1String("text/html")) { auto encoding = QStringConverter::encodingForHtml(ba); if (encoding) { QStringDecoder toUtf16(*encoding); return QString(toUtf16(ba)); } // fall back to utf8 } return QString::fromUtf8(ba); }
Attachments
Issue Links
- relates to
-
QTBUG-84662 Drag/drop of "text/plain" does not work, QMimeData::text() returns an empty string
-
- Closed
-
For Gerrit Dashboard: QTBUG-102438 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
405586,2 | QMimeData: return null string for null byte array | dev | qt/qtbase | Status: MERGED | +2 | 0 |
406429,3 | QMimeData: return null string for null byte array | 6.3 | qt/qtbase | Status: MERGED | +2 | 0 |
406430,2 | QMimeData: return null string for null byte array | 6.2 | qt/qtbase | Status: ABANDONED | -1 | 0 |
407296,2 | QMimeData: return null string for null byte array | tqtc/lts-6.2 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |