summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qmacclipboard.h
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-11-02 14:13:54 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-11-07 09:31:04 +0100
commitbf08aac46ad50ae08cc0c5481bc66e962b8105bb (patch)
tree24226c619c687dc56c64819ce930c03b06c67ba7 /src/plugins/platforms/cocoa/qmacclipboard.h
parenta1622083db02514cb82a49d5c792e8de70fb2f9f (diff)
macOS: Make QMacMime's handler scope type-safe
The value indicates for which systems the handler is relevant, e.g. clipboard and/or drag'n'drop. Rename the enum from "MimeType", which is something else already, to "HandlerScope". Make the enum a scoped enum to avoid implicit conversion to uchar, and to allow for better value names. Use the type in APIs and only convert to uchar when needed. Make respective arguments default to both DnD and clipboard implicitly, instead of explicitly interpreting an invalid zero-value as a default value. Task-number: QTBUG-93632 Change-Id: I85ab982f6c9fe78ea4d030dd0b0791c8ab866f67 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qmacclipboard.h')
-rw-r--r--src/plugins/platforms/cocoa/qmacclipboard.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qmacclipboard.h b/src/plugins/platforms/cocoa/qmacclipboard.h
index c17b8f6dd8..99337b74fd 100644
--- a/src/plugins/platforms/cocoa/qmacclipboard.h
+++ b/src/plugins/platforms/cocoa/qmacclipboard.h
@@ -5,6 +5,7 @@
#define QMACCLIPBOARD_H
#include <QtGui>
+#include <QtGui/private/qmacmime_p.h>
#include <ApplicationServices/ApplicationServices.h>
@@ -41,16 +42,16 @@ private:
QList<Promise> promises;
PasteboardRef paste;
- uchar mime_type;
+ const QMacMime::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, uchar mime_type=0);
- QMacPasteboard(uchar mime_type);
- QMacPasteboard(CFStringRef name=nullptr, uchar mime_type=0);
+ QMacPasteboard(PasteboardRef p, QMacMime::HandlerScope scope = QMacMime::HandlerScope::All);
+ QMacPasteboard(QMacMime::HandlerScope scope);
+ QMacPasteboard(CFStringRef name=nullptr, QMacMime::HandlerScope scope = QMacMime::HandlerScope::All);
~QMacPasteboard();
bool hasFlavor(QString flavor) const;