Implement of signals



  • In header file

    signals:
        void findNext(const QString &text, Qt::CaseSensitivity cs);
    

    in cpp file, i try to implement this signal like this

    void FindDialog::findNext(const QString &text, Qt::CaseSensitivity cs)
    {
       
    }
    

    But the compiler note me: error LNK1169 redefine symbol
    So i delete the signal implement in the cpp file, the program compile succed.
    Does it mean that i don't need to implement the signals?
    if my understanding is wrong, how can i implement my own signals?


  • Qt Champions 2016

    @ozzy said:

    signals:
    void findNext(const QString &text, Qt::CaseSensitivity cs);

    This defines the signal.
    You do not supply the body.

    To call it / use it.

    emit findNext( sometext, CaseInsensitive ); // signal the signal :) using real vars as parameters.

    Then somewhere else you
    connect findNext to someone's slot and it does the real work.

    in case you didnt see:
    http://doc.qt.io/qt-5.5/signalsandslots.html



  • I have read the link before, i will carefully read it again.
    thank you ~


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.