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
-