Results 1 to 4 of 4

Thread: Help with QtDBus signals

  1. #1
    Join Date
    Mar 2009
    Posts
    72
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Unhappy Help with QtDBus signals

    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

  2. #2
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Help with QtDBus signals

    i think you have registered the wrong service, it should be it.card-tech.pk.contextBar..u have used it.card-tech.pk.server...

  3. #3
    Join Date
    Mar 2009
    Posts
    72
    Thanks
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Help with QtDBus signals

    The problem is in service and interface names: the "-" character is not allowed

  4. #4
    Join Date
    May 2009
    Posts
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Help with QtDBus signals

    I having the exact same issue:

    process 10907: arguments to dbus_message_new_signal() were incorrect, assertion "interface != NULL" failed in file dbus-message.c line 1159.
    This is normally a bug in some application using the D-Bus library.

    This occurs when the signal is "emitted".

    And I'm not using "-" in my service name...

    Anybody has ideas of what could cause this?

Similar Threads

  1. QStateMachine and signals
    By rossm in forum Qt Programming
    Replies: 2
    Last Post: 26th March 2009, 10:43
  2. Signals are delayed on X11?
    By Cruz in forum Qt Programming
    Replies: 13
    Last Post: 18th February 2009, 12:59
  3. Signals and Slots
    By 83.manish in forum Qt Programming
    Replies: 3
    Last Post: 30th June 2008, 10:31
  4. QThread and signals (linux/UNIX signals not Qt Signals)
    By Micawber in forum Qt Programming
    Replies: 1
    Last Post: 28th November 2007, 22:18
  5. KDE Signals
    By chombium in forum KDE Forum
    Replies: 1
    Last Post: 25th January 2006, 18:45

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.