diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-11-15 11:36:51 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-11-16 22:14:00 +0100 |
commit | 649dccf57b18626f6a0790d46e5e619e4e603078 (patch) | |
tree | 8ace4469cf575ad8cbf0e50407688a3f13b99add /src/plugins/platforms/cocoa/qmacclipboard.h | |
parent | 427152c9b9e12d74fc5c7526148d09c5fba9263b (diff) |
Reintroduce converter APIs for supporting native clipboard formats
In Qt 5, QWin(dows)Mime and QMacMime lived in the respective Extras
modules, which were removed and partially folded into the relevant
modules in Qt. QWindowsMime and QMacMime continued to provide the
abstraction for implementing built-in support for native clipboard
formats and UTIs within Qt, but only as private APIs.
After the recent clean up of those APIs and respective infrastructure,
we can now bring them back as public converter interfaces. Application
developers can subclass those and instantiate an instance of their
implementation to add support for platform or application specific
data formats.
These interfaces are not in the QNativeInterface namespace, as
applications don't call into Windows or macOS using those interfaces.
I.e. there is no class on which an application would call
auto *converter= nativeInterface<QWindowsMimeConverter>();
Also, since applications override those converter types, we do want to
guarantee binary and source compatibility.
[ChangeLog][QtGui][QWindowsMimeConverter] Reintroduced to allow
applications to add support for conversion from and to Windows-native
clipboard formats to MIME-encoded data.
[ChangeLog][QtGui][QUtiMimeConverter] Reintroduced to allow
applications to add support for conversion from and to clipboard data on
macOS and iOS to MIME-encoded data.
Fixes: QTBUG-93632
Change-Id: Iebd909c3970015d203f59d5ab15e306b3d312f6e
Reviewed-by: Yuhang Zhao <2546789017@qq.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qmacclipboard.h')
-rw-r--r-- | src/plugins/platforms/cocoa/qmacclipboard.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/plugins/platforms/cocoa/qmacclipboard.h b/src/plugins/platforms/cocoa/qmacclipboard.h index f2a90b1347..030732446f 100644 --- a/src/plugins/platforms/cocoa/qmacclipboard.h +++ b/src/plugins/platforms/cocoa/qmacclipboard.h @@ -5,13 +5,13 @@ #define QMACCLIPBOARD_H #include <QtGui> -#include <QtGui/private/qmacmime_p.h> +#include <QtGui/qutimimeconverter.h> #include <ApplicationServices/ApplicationServices.h> QT_BEGIN_NAMESPACE -class QMacMime; +class QUtiMimeConverter; class QMacPasteboard { @@ -21,12 +21,12 @@ private: struct Promise { Promise() : itemId(0), converter(nullptr) { } - static Promise eagerPromise(int itemId, const QMacMime *c, const QString &m, QMimeData *d, int o = 0); - static Promise lazyPromise(int itemId, const QMacMime *c, const QString &m, QMimeData *d, int o = 0); - Promise(int itemId, const QMacMime *c, const QString &m, QMimeData *md, int o, DataRequestType drt); + static Promise eagerPromise(int itemId, const QUtiMimeConverter *c, const QString &m, QMimeData *d, int o = 0); + static Promise lazyPromise(int itemId, const QUtiMimeConverter *c, const QString &m, QMimeData *d, int o = 0); + Promise(int itemId, const QUtiMimeConverter *c, const QString &m, QMimeData *md, int o, DataRequestType drt); int itemId, offset; - const QMacMime *converter; + const QUtiMimeConverter *converter; QString mime; QPointer<QMimeData> mimeData; QVariant variantData; @@ -41,16 +41,16 @@ private: QList<Promise> promises; PasteboardRef paste; - const QMacMime::HandlerScope scope; + const QUtiMimeConverter::HandlerScope scope; mutable QPointer<QMimeData> mime; mutable bool mac_mime_source; bool resolvingBeforeDestruction; static OSStatus promiseKeeper(PasteboardRef, PasteboardItemID, CFStringRef, void *); void clear_helper(); public: - QMacPasteboard(PasteboardRef p, QMacMime::HandlerScope scope = QMacMime::HandlerScope::All); - QMacPasteboard(QMacMime::HandlerScope scope); - QMacPasteboard(CFStringRef name=nullptr, QMacMime::HandlerScope scope = QMacMime::HandlerScope::All); + QMacPasteboard(PasteboardRef p, QUtiMimeConverter::HandlerScope scope = QUtiMimeConverter::HandlerScope::All); + QMacPasteboard(QUtiMimeConverter::HandlerScope scope); + QMacPasteboard(CFStringRef name=nullptr, QUtiMimeConverter::HandlerScope scope = QUtiMimeConverter::HandlerScope::All); ~QMacPasteboard(); bool hasUti(const QString &uti) const; |