Nominate our 2022 Qt Champions!

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!

  • Lifetime Qt Champion

    hi and welcome
    if you mean the 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
    emit newFortune(fortune);

    and used by the signal and slot system.

    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