Hi, I need to send signals over a dbus connection.

This is the remote object adaptor code:

pkcontextbardbusadaptor.h
Qt Code:
  1. #include <QtDBus>
  2. #include "pkcontextbar.h"
  3.  
  4. class pkContextBarDBusAdaptor : public QDBusAbstractAdaptor
  5. {
  6. Q_OBJECT
  7. Q_CLASSINFO("D-Bus Interface", "it.card-tech.pk.contextBar")
  8.  
  9. protected:
  10. pkContextBar* m_owner;
  11.  
  12. public:
  13. pkContextBarDBusAdaptor(pkContextBar* owner);
  14.  
  15. public slots:
  16. int addAction(const QString& text);
  17. void clear();
  18.  
  19. private slots:
  20. void actionTriggered(QAction* action);
  21.  
  22. signals:
  23. void triggered(int);
  24. };
To copy to clipboard, switch view to plain text mode 

pkcontextbardbusadaptor.cpp
Qt Code:
  1. #include "pkcontextbardbusadaptor.h"
  2.  
  3. pkContextBarDBusAdaptor::pkContextBarDBusAdaptor(pkContextBar* owner)
  4. m_owner(owner)
  5. {
  6. this->connect(m_owner, SIGNAL(triggered(QAction*)), this, SLOT(actionTriggered(QAction*)));
  7. }
  8.  
  9. /** ... CUT ... **/
  10.  
  11. void pkContextBarDBusAdaptor::actionTriggered(QAction* action)
  12. {
  13. QList<QAction*> actions = m_owner->actions();
  14. int action_count = actions.count();
  15.  
  16. for (int i = 0; i < action_count; i++)
  17. {
  18. if (actions[i] == action)
  19. {
  20. emit triggered(i); // <--- Here is the problem.
  21. break;
  22. }
  23. }
  24. }
To copy to clipboard, switch view to plain text mode 

This is the pkContextBar constructor body, where I attach the dbus adaptor to the concrete object:

pkcontextbar.cpp
Qt Code:
  1. #include "pkcontextbar.h"
  2. #include "pkcontextbardbusadaptor.h"
  3.  
  4. pkContextBar::pkContextBar(QWidget* parent)
  5. : QMenuBar(parent),
  6. m_ui(new Ui::pkContextBar)
  7. {
  8. m_ui->setupUi(this);
  9.  
  10. new pkContextBarDBusAdaptor(this);
  11. }
To copy to clipboard, switch view to plain text mode 

The object is registered on the dbus in the main application body:

Qt Code:
  1. pkContextBar* context_bar = new pkContextBar(m_desktop);
  2. QDBusConnection bus = QDBusConnection::sessionBus();
  3. bus.registerService("it.card-tech.pk.server");
  4. bus.registerObject("/desktop/contextBar", context_bar);
To copy to clipboard, switch view to plain text mode 

When the pkContextBarDBusAdaptor::actionTriggered is invoked, the triggered signal emission fails and returns this error message:

process 16161: arguments to dbus_message_new_signal() were incorrect, assertion "_dbus_check_is_valid_interface (interface)" failed in file dbus-message.c line 1162.
This is normally a bug in some application using the D-Bus library.
QDBusConnection: Could not emit signal it.card-tech.pk.contextBar.triggered
Help me, please