diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-10-31 18:01:56 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-11-03 17:29:08 +0100 |
commit | 8f3e24c17d6aab9f95bd4dcfb28fc67b3a2768c0 (patch) | |
tree | 001a8c059953a808687b36c9a15f3110c81af352 /src/plugins | |
parent | 3d6a89c5cc30e12d694ecd6566cd7672e260c6f9 (diff) |
Clean up QMacMimeRegistry: remove convertor
It's not called anywhere, we always get all convertors and iterate over
them to find the best match for the relevant context. Change those
loops to use ranged for.
Task-number: QTBUG-93632
Change-Id: Icb450ca56310a0acab881899234ac647792ce0c9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/cocoa/qmacclipboard.mm | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/plugins/platforms/cocoa/qmacclipboard.mm b/src/plugins/platforms/cocoa/qmacclipboard.mm index 6adc2ce145..9900d0e6a9 100644 --- a/src/plugins/platforms/cocoa/qmacclipboard.mm +++ b/src/plugins/platforms/cocoa/qmacclipboard.mm @@ -299,7 +299,7 @@ QMacPasteboard::setMimeData(QMimeData *mime_src, DataRequestType dataRequestType delete mime; mime = mime_src; - QList<QMacInternalPasteboardMime*> availableConverters = QMacMimeRegistry::all(mime_type); + const QList<QMacInternalPasteboardMime*> availableConverters = QMacMimeRegistry::all(mime_type); if (mime != nullptr) { clear_helper(); QStringList formats = mime_src->formats(); @@ -316,8 +316,7 @@ QMacPasteboard::setMimeData(QMimeData *mime_src, DataRequestType dataRequestType } for (int f = 0; f < formats.size(); ++f) { QString mimeType = formats.at(f); - for (QList<QMacInternalPasteboardMime *>::Iterator it = availableConverters.begin(); it != availableConverters.end(); ++it) { - QMacInternalPasteboardMime *c = (*it); + for (auto *c : availableConverters) { // Hack: The Rtf handler converts incoming Rtf to Html. We do // not want to convert outgoing Html to Rtf but instead keep // posting it as Html. Skip the Rtf handler here. @@ -434,9 +433,8 @@ QMacPasteboard::retrieveData(const QString &format, QMetaType) const return QByteArray(); qCDebug(lcQpaClipboard, "Pasteboard: retrieveData [%s]", qPrintable(format)); - const QList<QMacInternalPasteboardMime *> mimes = QMacMimeRegistry::all(mime_type); - for (int mime = 0; mime < mimes.size(); ++mime) { - QMacInternalPasteboardMime *c = mimes.at(mime); + const QList<QMacInternalPasteboardMime *> availableConverters = QMacMimeRegistry::all(mime_type); + for (const auto *c : availableConverters) { QString c_flavor = c->flavorFor(format); if (!c_flavor.isEmpty()) { // Converting via PasteboardCopyItemFlavorData below will for some UITs result |