2

我正在尝试连接到 amarok d-bus 信号 StatusChange(参考:https ://xmms2.org/wiki/MPRIS#StatusChange )。接口和结构都可以,因为我可以在同一个接口中连接到简单的信号 CapsChange(int) 并且可以通过 GetStatus dbus 方法获取状态,所以这个 marshall 结构是可以的:

struct AmarokStatus {
    int st1;
    int st2;
    int st3;
    int st4;
};

Q_DECLARE_METATYPE(AmarokStatus)
qDBusRegisterMetaType<AmarokStatus>();

但是当调用时:

mInf = new QDBusInterface("org.mpris.MediaPlayer2.amarok", "/Player",
                          "org.freedesktop.MediaPlayer", QDBusConnection::sessionBus(),this);
connect(mInf, SIGNAL(StatusChange(AmarokStatus)), this, SLOT(statusChanged(AmarokStatus)));
connect(mInf, SIGNAL(CapsChange(int)), this, SLOT(capsChange(int)));

我收到消息:

Object::connect: 没有这样的信号 org::freedesktop::MediaPlayer::StatusChange(AmarokStatus)

我尝试过使用 SIGNAL(StatusChange(struct)) 和 SIGNAL(StatusChange(QDbusargument)) 和其他类型,但消息相同

D-Feet 是说 StatusChange 的定义是:StatusChange(Struct of (Int32, Int32, Int32, Int32)),与 dbus-monitor 相同。信号 TrackChange(结构数组)也存在同样的问题。所以我肯定在用 connect() 方法搞砸了。

4

0 回答 0