⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

Error with connect, singal

  • Welcome,
    i create that connect:

    SIGNAL(requestGreen(const QString,const QString)),
    SLOT(createGreen(const QString, const QString)));@

    in class utilis
    function green

    @void utilis::green(const QString name,const QString p){
    emit requestGreen(name,p);

    file utilis.h
    void requestGreen(const QString, const QString);@


    @public slots:
    void createGreen(const QString,const QString);@

    When i call function green in class utilis, program exit, when i run wiht debuger program stop in moc file

    @void utilis::requestGreen(const QString _t1, const QString _t2)
    void _a[] = { 0, const_cast<void>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) };
    QMetaObject::activate(this, &staticMetaObject, 0, _a);

    @QMetaObject::activate(this, &staticMetaObject, 0, _a);@

    and now i don't now where is error in my code, somebody help me?

  • Hi, I don't see any problem in your code, but your can try using references for the QString parameters. that is more usual and might fix your problem, but it should still work without references, maybe worth a try
    const QString&
    // instead of just
    const QString
    also you should add parameter names for signals and slots, again it should work without them but it's better to specify names anyways, in case you use Qt Quick or something it will be hard without any to reference the variables from the script language. :)

  • when i change in connect vars (add reference), and in signal and slot, nothing change, error this same:

    &"warning: GDB: Failed to set controlling terminal: incorrect ioctl for device"
    Could not load shared library symbols for linux-gate.so.1.
    Do you need "set solib-search-path" or "set sysroot"?

    i use qt creator 3.1.8 and qt widget project.
    my system is linux (Debian 7 32bit)

  • I don't know but those warning seems not to be related to the signal and slot, maybe there are some other errors in your project somewhere and it only crashes in the at that position!? Hard to say you only posted the signal and slot that there is no error.
    There could also be an error in your build system :/

  • without using connect all is ok, i try use in signal empty function and nothing

    i try in new project use only connect to veryfi is problem with connect or not

  • Lifetime Qt Champion


    Can you show the headers of the concerned classes ?

  • Thanks all for help,
    i found error, problem with connect, when i move to other class all is ok and work great :), (i used connect other class and next connect to update ui)

Log in to reply