From c7d4858c921c7602dc90d56cdd903cd2cb1111c6 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 14 May 2016 07:32:03 +0200 Subject: QDBusArgument: deprecate relying on a streamable Base to stream a Derived This was seen in the wild for QList, but, as described in the documentation note, it's a common problem. [ChangeLog][QtDBus][QDBusArgument] Deprecated relying on a streamable Base to stream a Derived without providing operator<>() for Derived. No diagnostic provided. Task-number: QTBUG-53376 Change-Id: If845574f731b537c20641dc7c49fa4369e85db5a Reviewed-by: Thiago Macieira --- src/dbus/qdbusmetatype.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp index 5696290ed3..59a71ade3e 100644 --- a/src/dbus/qdbusmetatype.cpp +++ b/src/dbus/qdbusmetatype.cpp @@ -177,7 +177,7 @@ Q_GLOBAL_STATIC(QReadWriteLock, customTypesLock) \snippet code/src_qdbus_qdbusmetatype.cpp 0 - If \c{T} isn't a type derived from one of + If \c{T} isn't one of Qt's \l{container classes}, the \c{operator<<} and \c{operator>>} streaming operators between \c{T} and QDBusArgument must be already declared. See the \l {qdbustypesystem.html}{Qt D-Bus @@ -187,6 +187,14 @@ Q_GLOBAL_STATIC(QReadWriteLock, customTypesLock) This function returns the Qt meta type id for the type (the same value that is returned from qRegisterMetaType()). + \note The feature that a \c{T} inheriting a streamable type (including + the containers QList, QHash or QMap) can be streamed without providing + custom \c{operator<<} and \c{operator>>} is deprecated as of Qt 5.7, + because it ignores everything in \c{T} except the base class. There is + no diagnostic. You should always provide these operators for all types + you wish to stream and not rely on Qt-provided stream operators for + base classes. + \sa {qdbustypesystem.html}{Qt D-Bus Type System}, qRegisterMetaType(), QMetaType */ -- cgit v1.2.3