sudeepdino008
sudeepdino008

Reputation: 3364

signals and slots in Qt

I was going through this Qt tutorial where I came across a pretty interesting line of code

connect(slider,SIGNAL(valueChanged(int)),this,SIGNAL(valueChanged(int)));   

Generally when a signal is emitted, then a slot is called. What is meant by this statement? the "slider" is a QSlider object pointer.

If helpful, this is the tutorial .

Upvotes: 1

Views: 179

Answers (1)

Rudolfs Bundulis
Rudolfs Bundulis

Reputation: 11934

This statement tells the qt signal/slot mechanism to connect two signals, making the second being emitted if the first one is emitted. Look at documentation of QObject::connect it has an example where a signal from a private member variable is made available by connecting it to a public signal of the owner class, but i guess that is just one use case.

Upvotes: 8

Related Questions