Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Signal connected but not emitted on QAxObject



  • Hi,

    here is my Problem:

    i try to cennect to a signal that is emited by e COM Object. The signal has a struct as argument. i know that the signal is emited because i have a slot listening on the signal signal(QString, int, void * ). But my SLOT for the special signal is never called. The over signals that have simple arguments are called without a problem.
    i also tryed a to use class instead of a struct for mySpecialStructType. it gave me the same result.

    @
    struct mySpecialStructType{
    QString Name;
    int Number;
    ....
    };

    ...
    Q_DECLARE_METATYPE(mySpecialStructType )

    ...

    MyClass::MyClass()
    {
    ...
    qRegisterMetaType<mySpecialStructType>();

    mySpecialStructType test;
    QVariant a = QVariant::fromValue(test);
    
    qDebug<<"canconvert? "<<(bool) a.canConvert<mySpecialStructType>();
    
     QAxObject myObject = new QAxObject("{myid}");
    
    connect(myObject, SIGNAL(myEasySignal(int )), 
            this,SLOT(myEasySlot(int)));
    
     connect(myObject, SIGNAL(mySignal(mySpecialStructType )), 
            this,SLOT(mySlot(mySpecialStructType)));
    
     connect(myObject, SIGNAL(signal(QString, int, void * )), 
            this,SLOT(signalrecord(QString , int , void * )));
    
      m440ax->dumpObjectInfo();
    

    ...
    }

    void MyClass::signalrecord(QString name, int argc, void * argv)
    {
    qDebug()<<"----signal:"<<name<<"("<<argc<<")";
    }

    void MyClass::mySlot(mySpecialStructType foo)
    {
    qDebug()<<"mySlot was called!";
    }

    void MyClass::myEasySlot(int number)
    {
    qDebug()<<"Easyslot: "<<number;
    }
    @

    this gives me the output:

    ...
    canconvert? true

    SIGNALS OUT

    signal: signal(QString,int,void*)

          --&gt; MyClass::MyClass signalrecord(QString,int,void*)
    

    signal: mySignal(mySpecialStructType )

          --&gt; MyClass::MyClass  mySlot(mySpecialStructType)
    

    signal: myEasySignal(mySpecialStructType )

          --&gt; MyClass::MyClass  myEasySlot(mySpecialStructType)
    

    ...
    ----signal: "myEasySignal(int )" ( 1 )
    EasySlot: 3
    ----signal: "myEasySignal(int )" ( 1 )
    Easyslot: 2

    ...

    ----signal: "mySignal(mySpecialStructType )" ( 1 )
    ----signal: "mySignal(mySpecialStructType )" ( 1 )

    ...

    what am i doing wrong?
    why is my slot not beeing called?

    greetings eddy


Log in to reply