D-Busには信号があります(Qt信号ではありませんが、QDBusAbstractAdaptor
と一緒に使用すると信号にマッピングされます)。
class MainApplicationAdaptor: public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.DBus.MainApplication")
Q_PROPERTY(QString caption READ caption WRITE setCaption)
Q_PROPERTY(QString organizationName READ organizationName)
Q_PROPERTY(QString organizationDomain READ organizationDomain)
...
signals:
void aboutToQuit();
void mainWindowHasFocus();
};
インタフェースの定義:
interface org.kde.DBus.MainApplication
{
property readwrite STRING caption
property read STRING organizationName
property read STRING organizationDomain
method quit() annotation("org.freedesktop.DBus.Method.NoReply", "true")
method reparseConfiguration()
method mainWindowObject(out STRING)
method disableSessionManagement(in BOOLEAN enable)
signal aboutToQuit()
signal mainWindowHasFocus()
}
This example
は、クライアントに通知を送信することができ、サーバD-BUSオブジェクトを示してい