Qt for the same signal on 2 slots on the same object?

I am new to Qt. When I read the documentation, I came across this configuration:

connect( Object1, Signal1, Object2, slot1 )
connect( Object1, Signal1, Object2, slot2 )

What could be a precedent for this?

It looks strange to me, coming from the Erlang / Python background. This should be due to inheritance twists in C ++, and I think it is possible.

+5
source share
3 answers

This applies to cases where you have something like one button that changes two parts of another. This may seem silly, but it would be equivalent to calling a function of the second slot from the first slot.

, / , . , . , 2 .

+4

1 slot2 .

connect( Object1, Signal1, Object2, slot1 );
connect( Object1, Signal1, Object2, slot2 );
connect( Object3, Signal1, Object2, slot1 );
connect( Object4, Signal1, Object2, slot2 );
+3

MVC... , "" , , ...

PieChart :

connect( MySourceModel, SIGNAL(newDataAreThere()), PieChartView, SLOT(notifyNewDataReceived()));

... :

connect( MySourceModel, SIGNAL(newDataAreThere()), AnotherView, SLOT(notifyNewDataReceived()));

/ , , ... ...

, ;)

0

All Articles