Skip to content

Commit

Permalink
fix: updateProp cannot convert to property type
Browse files Browse the repository at this point in the history
if there is a property, try to convert to the type

Log:
  • Loading branch information
Decodetalkers committed Jul 4, 2023
1 parent e10d0b4 commit 3712d3f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/util/ddbusinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ void DDBusInterfacePrivate::updateProp(const char *propName, const QVariant &val
const QMetaObject *metaObj = m_parent->metaObject();
const char *typeName(value.typeName());
void *data = const_cast<void *>(value.data());
if (value.canConvert<QDBusArgument>()) {
int propertyIndex = metaObj->indexOfProperty(propName);
QVariant result = value;
if (propertyIndex != -1) {
QMetaProperty metaProperty = metaObj->property(propertyIndex);
result = demarshall(metaProperty, value);
data = const_cast<void *>(result.data());
typeName = result.typeName();
} else if (value.canConvert<QDBusArgument>()) {
auto dbusType = qvariant_cast<QDBusArgument>(value);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
auto dbusMetaType = QDBusMetaType::signatureToMetaType(dbusType.currentSignature().toUtf8());
Expand Down

0 comments on commit 3712d3f

Please sign in to comment.