3

When I run the Qt Creator dbus examples, they couldn't run, is there any settings or stuff for working QtDbus module or any prerequistics?

for example in chat project:

if (!QDBusConnection::sessionBus().isConnected()) {
    qWarning("Cannot connect to the D-Bus session bus.\n"
             "Please check your system settings and try again.\n");
    return 1;
}

returns 1 and program terminated.

2
  • Do you have dbus-daemon running?
    – MrEricSir
    Apr 17, 2015 at 17:38
  • Not very surprising since running D-Bus on Windows is very unusual. That said, you could file a documentation bug report here: bugreports.qt.io
    – MrEricSir
    Apr 17, 2015 at 18:17

2 Answers 2

5

Finally I found the solution:

For QtDbus module get working, The 3rd party Dbus module must be installed in Windows:

Dbus Windows Installer Download

After downloading and installing Dbus, it gets working without any configuration. (for working QtDbus, dbus-daemon.exe must be running)

3
  • 1
    How do you get dbus-daemon.exe running? It seems it asks for a bunch of parameters, I tried giving it the path of the conf files but that didn't help. I also tried running dbus-launch.exe, does seem to do anything either.
    – RHawkeyed
    Aug 31, 2015 at 8:53
  • 1
    Nvm, I am just not very experienced with command line :) dbus-daemon.exe --config-file=..\etc\session.conf got it started in case someone has the same problem
    – RHawkeyed
    Aug 31, 2015 at 9:01
  • The link no longer works. I think https://code.google.com/archive/p/dbus-windows-installer/downloads is the fixed link, however I have no idea if this works in current versions of Qt the link is from 2011.
    – drescherjm
    Nov 2, 2021 at 14:36
1

Thankyou, you gave me the clues i needed to get started. However, in order to move with the times and keep this topic up to date...

I am using Qt 5.7.0 and no matter what I tried I could not get dbus v1.4.2 or 1.4.6 from your link to work with Qt.

It seems for Qt 5.7.0 a newer version of DBus is needed (I don't know the technical detail of why this is the case)... luckily I have stumbled across 1.8.10 prebuilt:

http://lists.qt-project.org/pipermail/development/2014-December/019502.html

All credit should go to the original compiler of this package, not to me, but if the link goes down, I will do my best to rehost and update, just drop me a comment.

All QDBus examples from Qt5.7.0 work out of the box with this version.

For anyone who is inclined to start fiddling with bus addresses, environment variables, config files, etc... try this later build FIRST!

Obviously, this version is just a zip, not an installer - so you need to add the "bin" folder to your $PATH.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.