QDBusReplyreply = interface->call("methodName", arg1, arg2); if (reply.isValid()) { QVariant value = reply.value(); // Do something with the value.. }
QDBusReplyThis example calls the same D-Bus method as in the previous example, but this time it checks for errors. If the reply object is not valid, it means that an error occurred during the method call and the error details can be accessed through the error() method. Package library: QtDBus.reply = interface->call("methodName", arg1, arg2); if (reply.isValid()) { // No errors, do something with the value.. } else { qWarning() << reply.error().message(); // Print the error message }