The solution is to set some environment variables. I set the address in qt but the environments are required for the libdbus library.

Set the

DBUS_SESSION_BUS_ADDRESS

and

DBUS_SESSION_BUS_PID