diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-05-27 15:34:10 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-05-27 15:34:10 +0200 |
commit | 518cf3312c101ea1c5ae5199611ebda46a74dadd (patch) | |
tree | fe580d423d8938caad9d6705c7ef9da13d2d8e14 /src/plugins/platforms/cocoa/qmacclipboard.mm | |
parent | 59937de098dd86472e73146bd0c84e980022e24d (diff) | |
parent | 65cfac73bd1c09eafadf57a3b7161f52b186c37d (diff) |
Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: Ia279fc4a8226626041c772902a07b2f90f37b53b
Diffstat (limited to 'src/plugins/platforms/cocoa/qmacclipboard.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qmacclipboard.mm | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/plugins/platforms/cocoa/qmacclipboard.mm b/src/plugins/platforms/cocoa/qmacclipboard.mm index ba6cfca219..358a6b49fd 100644 --- a/src/plugins/platforms/cocoa/qmacclipboard.mm +++ b/src/plugins/platforms/cocoa/qmacclipboard.mm @@ -489,19 +489,16 @@ QMacPasteboard::retrieveData(const QString &format, QVariant::Type) const QMacInternalPasteboardMime *c = mimes.at(mime); QString c_flavor = c->flavorFor(format); if (!c_flavor.isEmpty()) { - // Handle text/plain a little differently. Try handling Unicode first. - bool checkForUtf16 = (c_flavor == QLatin1String("com.apple.traditional-mac-plain-text") - || c_flavor == QLatin1String("public.utf8-plain-text")); - if (checkForUtf16 || c_flavor == QLatin1String("public.utf16-plain-text")) { - // Try to get the NSStringPboardType from NSPasteboard, newlines are mapped - // correctly (as '\n') in this data. The 'public.utf16-plain-text' type - // usually maps newlines to '\r' instead. + // Converting via PasteboardCopyItemFlavorData below will for some UITs result + // in newlines mapping to '\r' instead of '\n'. To work around this we shortcut + // the conversion via NSPasteboard's NSStringPboardType if possible. + if (c_flavor == QLatin1String("com.apple.traditional-mac-plain-text") + || c_flavor == QLatin1String("public.utf8-plain-text") + || c_flavor == QLatin1String("public.utf16-plain-text")) { QString str = qt_mac_get_pasteboardString(paste); if (!str.isEmpty()) return str; } - if (checkForUtf16 && hasFlavor(QLatin1String("public.utf16-plain-text"))) - c_flavor = QLatin1String("public.utf16-plain-text"); QVariant ret; QList<QByteArray> retList; |