I have both a QSlider and a QSpinBox, and I wanted their values to be always equal, so I connected the slider's valueChanged(int)
signal to the spinbox' setValue(int)
slot, and vice versa: (of course, I also set the min and max values to be equal)
connect(delay_slider, SIGNAL(valueChanged(int)),
delay_spin, SLOT(setValue(int)));
connect(delay_spin, SIGNAL(valueChanged(int)),
delay_slider, SLOT(setValue(int)));
I tested, and it works (at least on my Ubuntu 12.04 LTS x86_64, g++ 4.6.3, Qt 4.8.1).
Now, I think that when I emit one of the signals, it will trigger the other, which will trigger the first one, which will trigger the other, etc. How does Qt handle that? Is there a document that describes the mechanisms used?
Obs: I called it a "loop of event emits" because this has nothing to do with the Qt Event Loop