qtqdbus

Exact type of QDBusArgument


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?


Solution

  • 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();