Missing method with Blocking Fortune Client Network Example



  • Which library resolves the two methods >void newFortune(const QString &fortune)< and >void error(int socketError, const QString &message)<? Thanks a lot!


  • Qt Champions 2016

    hi and welcome
    if you mean the signals

    signals:
    void newFortune(const QString &fortune);
    void error(int socketError, const QString &message);

    they are mere signature. There is not a body defined.
    they are used with emit command
    like
    emit newFortune(fortune);

    and used by the signal and slot system.
    http://doc.qt.io/qt-5.5/signalsandslots.html

    so while it looks like a normal method. there is no body defined for it as
    its used just to SIGNAL something.

    Then one or more other classes can be connected into this signal and have their slot ( normal method) called when this signal is emitted.

    Hope it makes it more clear.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    For more details about how the internal works, here's a very good article from Woboq.


Log in to reply
 

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