Revert "QDBusArgument: remove useless op<< overloads"
This reverts commit 5f542f3cca13f2da58b82aee2efbaffefeee00a7, since it breaks streaming of types derived from QList and the docs state that this should be possible without providing custom op<</>> for such types. Task-number: QTBUG-53376 Change-Id: I2bde714ac384f2aed67ad30decea702fb79aef1b Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
c7d4858c92
commit
d55f2b1fb9
@ -261,6 +261,35 @@ inline const QDBusArgument &operator>>(const QDBusArgument &arg, Container<T> &l
|
||||
return arg;
|
||||
}
|
||||
|
||||
// QList specializations
|
||||
template<typename T>
|
||||
inline QDBusArgument &operator<<(QDBusArgument &arg, const QList<T> &list)
|
||||
{
|
||||
int id = qMetaTypeId<T>();
|
||||
arg.beginArray(id);
|
||||
typename QList<T>::ConstIterator it = list.constBegin();
|
||||
typename QList<T>::ConstIterator end = list.constEnd();
|
||||
for ( ; it != end; ++it)
|
||||
arg << *it;
|
||||
arg.endArray();
|
||||
return arg;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline const QDBusArgument &operator>>(const QDBusArgument &arg, QList<T> &list)
|
||||
{
|
||||
arg.beginArray();
|
||||
list.clear();
|
||||
while (!arg.atEnd()) {
|
||||
T item;
|
||||
arg >> item;
|
||||
list.push_back(item);
|
||||
}
|
||||
arg.endArray();
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantList &list)
|
||||
{
|
||||
int id = qMetaTypeId<QDBusVariant>();
|
||||
@ -273,6 +302,7 @@ inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantList &list)
|
||||
return arg;
|
||||
}
|
||||
|
||||
// QMap specializations
|
||||
template<typename Key, typename T>
|
||||
inline QDBusArgument &operator<<(QDBusArgument &arg, const QMap<Key, T> &map)
|
||||
{
|
||||
@ -321,6 +351,7 @@ inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantMap &map)
|
||||
return arg;
|
||||
}
|
||||
|
||||
// QHash specializations
|
||||
template<typename Key, typename T>
|
||||
inline QDBusArgument &operator<<(QDBusArgument &arg, const QHash<Key, T> &map)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user