Nominate our 2022 Qt Champions!

What happens after a SLOT has been handled?

  • Hey guys,

    I'm new to Qt and loving it so far, but I wanted to ask you guys a question.
    Does anyone know, what the routine does after a "SIGNAL->SLOT" has been handled, so when I for example, press a button and then handle the SLOT event, where does the routine go afterwards, when there is no immediate action to follow?
    I'm asking, because right now I'm looking for an error, that occurs immediately after a SLOT has been dealt with, and the debugger stands on my Main.cpp line "return a.exec()" and I'm not sure, where exactly I should be. :)

    And sometimes I get thrown to this function:

    static void deallocate(QArrayData *data)
    Q_STATIC_ASSERT(sizeof(QTypedArrayData) == sizeof(QArrayData));
    QArrayData::deallocate(data, sizeof(T), Q_ALIGNOF(AlignmentDummy));

    thanks in advance, and all the Best from Austria!

    EDIT: Found my error, was passing the address of a StackItem and tried to access it later!
    but still, would be curious what happens after a handled Slot! :D

  • Depends on whether the signal-slot connection is synchronous or asynchronous.

    By default, the connection is synchronous if both sender and receiver are in the same thread. In this case, emitting a signal is much like a function call. If multiple slots are connected to a signal, they are called one after the other. After the last slot has been called, there's some cleanup, then the code returns to the line after the emit statement.

    If the connection is asynchronous, then the slot is executed within the event loop. So the code will return to the event loop after executing the slot.

  • Thanks so much for the explanation and your time! :)

Log in to reply