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

Qt 4.8.3, signal and slot connections



  • I'm using an older version of Qt for a project where I currently cannot use a later version because the SDK that issues uses this old version.

    Anyway....I have to connect signals and slots, my system has Qt version 5.12 and I'm trying to transfer some code from that system to the older version.

    My connection looks like this:

        QObject::connect(pwndMain
                        ,&clsMainWnd::systemBattery
                        ,mpdlgDisplaySettings
                        ,&clsXMLnode::systemBattery);
    

    Both systemBattery signals and slots have the exact same prototype:

        void systemBattery(int intBattery);
    

    When I build the project using the older Qt version I get:

        no matching function for call to 'clsMainWnd::connection(clsMainWnd* const,const char*,clsDisplaySettings*&,const char*)'
    

    How do I implement this using what is available in the older version?

    I've also tried:

        Object::connect(pwndMain
                       ,SIGNAL(systemBattery(int))
                       ,mpdlgDisplaySettings
                       ,SLOT(systemBattery(int)));
    

    I got the same message.


  • Lifetime Qt Champion

    You can't use the new signal/slot syntax with Qt4.


  • Lifetime Qt Champion

    Why do you delete your post? The problem may have others too but now nobody can find the answer because you deleted your post...



  • I have and it works, the reason it didn't work was because I forgot to add QObject and Q_OBJECT to the slot class definition.

    Once I did that the warnings went away. Just to be clear I used the later connect method in my post which works fine.



  • @SPlatten it seems you was able to solve your issue. If so please don't forget to mark your post as such. Thanks


Log in to reply