Important: Please read the Qt Code of Conduct -

Pass DBus method call an array

  • Hi, I can't pass an array to a QDBusMessage

    I tried
    uchar a[1] = {0};
    msg << a;

    But I get a "QVariant::QVariant(void *) is private" error

    I've also tried
    @QDBusArgument *arg=new QDBusArgument();

    msg << arg;

    But I get the same error.


  • operator<< of QDBusMessage takes a QVariant as argument. There's no implicit conversion between an array of uchar and QVariant, that's why the compiler bails out. You will have to create a QVariant with the contents of your array.

Log in to reply