M
M
Mercury132016-01-08 17:12:28
Qt
Mercury13, 2016-01-08 17:12:28

Qt: similar to dynamic_cast(Sender)?

What is the standard way to handle events in Embarcadero Delphi/Builder?
We double-click on the desired event, and the automation generates something like this code.

void acRunExecute(TObject* Sender)
{
    // тут писать код
}

If you need to process a number of similar events in this way, the function is the same. And who called this function can be determined, for example, by dynamic_cast<TAction*>(Sender)->Tag.
Now we have Qt. Either through connect, or by visual editing - we connect the signal to the slot. Is it possible to send several signals to one slot, and even figure out who sent this signal and how to process it?
PS Yes, I know that several signals can be in one slot. Read the question more carefully: it is important to me who caused the signal.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Taratin, 2016-01-08
@Mercury13

doc.qt.io/qt-4.8/qobject.html#sender

A
Antony, 2016-01-08
@RiseOfDeath

You can connect as many signals as you like to a slot (exactly as many slots as you like to a signal).
At the expense of the sender .... if memory serves, you can see it, but I don’t remember how.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question