diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-07-30 22:42:31 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-08-24 00:17:03 +0200 |
commit | ed8acbeb7c6fd137486b5c8a6eec58a3b9db862c (patch) | |
tree | d92c3f06a07082e2cc40be366faac8bc58b82def /src/corelib/kernel/qmimedata.cpp | |
parent | 5282545589244c1a3e01442e3586d5666213f76d (diff) |
Automatically register data/debug stream operations in QMetaType
And remove the old manual registration code for those operators.
Add some special handling for long/ulong, as these types could be
streamed as a QVariant so far, but are not directly streamable
through QDataStream.
[ChangeLog][QtCore][QMetaType] The QMetaType::registerStreamOperators()
and QMetaType::registerDebugStreamOperator() methods have been
removed. The streaming operators for a type are now automatically
registered together with the type registration. This implies that the
operators should be visible wherever the type is visible and being used.
[ChangeLog][Behavior Incompatible Changes] Because the QDataStream and
QDebug serialization operators are automatically registered with
QMetaType, the declarations of those functions must be present at any
point where the type is used with QMetaType and QVariant.
Change-Id: I4a0732651b20319af4a8397ff90b848ca4580d99
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/kernel/qmimedata.cpp')
-rw-r--r-- | src/corelib/kernel/qmimedata.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/corelib/kernel/qmimedata.cpp b/src/corelib/kernel/qmimedata.cpp index 21a1350fc5..f2641adcd8 100644 --- a/src/corelib/kernel/qmimedata.cpp +++ b/src/corelib/kernel/qmimedata.cpp @@ -583,11 +583,9 @@ QByteArray QMimeData::data(const QString &mimeType) const Note that if you want to use a custom data type in an item view drag and drop operation, you must register it as a Qt \l{QMetaType}{meta type}, using the - Q_DECLARE_METATYPE() macro, and implement stream operators for it. The stream - operators must then be registered with the qRegisterMetaTypeStreamOperators() - function. + Q_DECLARE_METATYPE() macro, and implement stream operators for it. - \sa hasFormat(), QMetaType, {QMetaType::}{qRegisterMetaTypeStreamOperators()} + \sa hasFormat(), QMetaType, {QMetaType::}{Q_DECLARE_METATYPE()} */ void QMimeData::setData(const QString &mimeType, const QByteArray &data) { |