1

Using currentType() I can get the ElementType of a QDBusArgument. That is a very unprecise information that tells me if it is an array, a basic type etc. I could not find a way to dig deeper. E.g. if it is a basic type... which exactly? Short? Int?

Is it possible to get the exact type of a QDBusArgument for debugging purpose?

Silicomancer
  • 8,604
  • 10
  • 63
  • 130

1 Answers1

0

It looks like if you convert a primitive type QDBusArgument to a QVariant, it will contain the exact type of the argument (1). You can then use QVariant::type() or QVariant::typeName() to get the variant QMetaType or a human-readable value:

QDBusArgument argument;
qDebug() << argument.asVariant().typeName();
ajshort
  • 3,684
  • 5
  • 29
  • 43
  • It works in such way only for basic types (as already stated in documentation you referenced). Unfortunately there are no way to get user-defined meta typeId, registered with qDBusRegisterMetaType(). At least, I didn't found yet. Furthermore, it makes qdbus_cast(...) useless... – Artem Pisarenko Mar 23 '18 at 13:46