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.

Reza Ebrahimi
  • 3,623
  • 2
  • 27
  • 41

2 Answers2

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)

Reza Ebrahimi
  • 3,623
  • 2
  • 27
  • 41
  • 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 '15 at 08: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 '15 at 09:01
  • The link no longer works. I think [https://code.google.com/archive/p/dbus-windows-installer/downloads](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 02 '21 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.

Mark Ch
  • 2,840
  • 1
  • 19
  • 31