Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-33142

Inherited signals do not work via D-Bus

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.5.2, 6.6.0
    • 4.8.4, 5.12.1, 6.5.0
    • D-Bus
    • None
    • Centos 6.4 x86_64
    • c96840545 (dev), 6c5d48af3 (6.5)
    • Foundation Sprint 82

    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_EMIT signal1(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_EMIT signal2(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"

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ievgenii.meshcheriakov Ievgenii Meshcheriakov
            ts Thomas Sondergaard
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes