I'm working with QtDbus and I need to handle DBus signal. I'm doing this by connecting DBus' signal to Qt slot like this:
bool res = QDBusConnection::systemBus().connect(kBusName, adapterPath, kInterfaceName,
QLatin1String("PropertiesChanged"),
this, SLOT(_handlePropertyChange(const QString &, PropertiesList , const QStringList &)));
Now, as there gonna be multiple DBus devices` signals handled in one Qt slot, I would like to send some additional information (device's address, which I have at the momment of connection) with this signal.
In Qt5-style connects, it's possible to do something like this with lambdas:
quint64 address;
bool res = QDBusConnection::systemBus().connect(kBusName, adapterPath, kInterfaceName,
QLatin1String("PropertiesChanged"),
this, [address, this](const QString & arg1, PropertiesList arg2, const QStringList &arg3) {
_handlePropertyChange(const QString & arg1, PropertiesList arg2, const QStringList &arg3, address)
}); //just an example of lambda connection, won't compile
But there are no Qt5-style connects availible for QDBusConnection, and I understand this, as those connects are dynamic.
So question is: how can I bundle additional argument to each QDBusConnection::connect()?
Ideally, I would like to be able to do somethings like:
quint64 address;
bool res = QDBusConnection::systemBus().connect(kBusName, adapterPath, kInterfaceName,
QLatin1String("PropertiesChanged"),
this, SLOT(_handlePropertyChange(const QString &, PropertiesList , const QStringList &, quint64 adr = address /* bundle address here */)));