PDA

View Full Version : Signal and slots



villy
12th January 2007, 10:42
Hi all, I've a little question about Signal and Slot.
If I have a signal connected to more than one slot, it's possible to estabilish which slot is called first?
For example, I've three comboboxes. When I activate some item in the first one, i want to clear the other ones, and I want to insert new items into them. So I've connected acivated signal of the first one combo to clear() slot of the other ones, and the same activated signal to another slot that fills combos. But, when I activate an item in the first one combo, the other ones remain empty. This because, clear() slot is call after slot that fills combos.
I hope I've been clear :D

Thanks

camel
12th January 2007, 11:10
If I have a signal connected to more than one slot, it's possible to estabilish which slot is called first?


Taken From docs: (http://doc.trolltech.com/4.2/signalsandslots.html)

If several slots are connected to one signal, the slots will be executed one after the other, in an arbitrary order, when the signal is emitted.



For example, I've three comboboxes. When I activate some item in the first one, i want to clear the other ones, and I want to insert new items into them. So I've connected acivated signal of the first one combo to clear() slot of the other ones, and the same activated signal to another slot that fills combos. But, when I activate an item in the first one combo, the other ones remain empty. This because, clear() slot is call after slot that fills combos.
I hope I've been clear :D

Thanks


How about creating a new slot:


void SomeClass::SomeSlot()
{
//Clear combobox(es)
//fill combobox(es)
}