Details
Description
Signals inherited from a base class are not emitted properly via D-Bus. They are visible in qdbusviewer but they are not emitted properly.
Steps to reproduce:
1. Compile the example program below
2. Start qdbusviewer
3. In qdbusviewer, connect to signal1 and signal2 on /sub
4. Invoke emitSignal1() and emitSignal2() on /sub
5. Notice that only signal2 is received by qdbusviewer
Further tests show that emitSignal1() slot is invoked - it is the emission of the signal from the base class via D-Bus that is not working, not the slot invocation.
Build instructions for example program: moc-qt4 -o play.moc play.cc && g++ -Wall -g $(pkg-config --cflags --libs QtCore QtDBus) -o play play.cc
Example program play.cc:
#include <QCoreApplication>
#include <QObject>
#include <QDBusConnection>
class Test : public QObject
{
Q_OBJECT;
Q_CLASSINFO("D-Bus Interface", "test.Test");
public Q_SLOTS:
void emitSignal1(const QString &s)
Q_SIGNALS:
void signal1(const QString &s);
};
class SubTest : public Test
{
Q_OBJECT;
Q_CLASSINFO("D-Bus Interface", "test.SubTest");
public Q_SLOTS:
void emitSignal2(const QString &s)
Q_SIGNALS:
void signal2(const QString &s);
};
int main(int argc, char **argv)
{ QCoreApplication app(argc, argv); QDBusConnection connection = QDBusConnection::sessionBus(); connection.registerService("test.Test"); Test base; // signal1 works connection.registerObject("/base", &base, QDBusConnection::ExportAllContents); SubTest sub; // signal1 isn't emitted via D-Bus, slot *is* invoked, signal2 works connection.registerObject("/sub", &sub, QDBusConnection::ExportAllContents); return app.exec(); }#include "play.moc"