D-Bus: use move() on QVariants in writeProperty()
The writeProperty() function takes the QVariant value by value, so we can move from it, using the newly-added QMetaProperty::write() rvalue overload. As a drive-by, replace a copy-assignment with a move. Task-number: QTBUG-112762 Change-Id: I6d5361830b4874fa846be513882ede4ab881246b Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
1bf8c1e23d
commit
426b5fbce4
@ -332,14 +332,14 @@ static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant
|
||||
return PropertyWriteFailed;
|
||||
}
|
||||
|
||||
value = other;
|
||||
value = std::move(other);
|
||||
}
|
||||
|
||||
if (mp.metaType() == QMetaType::fromType<QDBusVariant>())
|
||||
value = QVariant::fromValue(QDBusVariant(value));
|
||||
|
||||
// the property type here should match
|
||||
return mp.write(obj, value) ? PropertyWriteSuccess : PropertyWriteFailed;
|
||||
return mp.write(obj, std::move(value)) ? PropertyWriteSuccess : PropertyWriteFailed;
|
||||
}
|
||||
|
||||
QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node,
|
||||
|
Loading…
Reference in New Issue
Block a user