问题
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.
回答1:
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)
回答2:
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.
来源:https://stackoverflow.com/questions/29702421/qtdbus-is-not-working-in-qt5-4-1-on-windows-7