On May 12, 3:21 ¨Âí¬ ìïìöåìåù ¼ìïìöå®®®Àùáèïï®æò÷òïôåº > hello, > > thank you richard and stefano for your answers. > I'm afraid I haven't well understood the system of slots, if I want to > rewrite a slot - say setValue(int) - of a dial what can I put in this > method? I have to put a statement telling the slot to modify graphically > the widget, but I don't think it is possible. > > I think _ but I'm not sure _ I have understood the solution of richard : > it is to create a class with a slot (for example setValue) which receive > the value in degree, and this slot emit a signal (here > dial.setValue(int)) which send the converted value (in Farenheit). You could emit a signal from the intermediate 'converter' Qt::Widget or Qt::Object which is connected to the target dial's 'setValue()' slot, or you can just call the slot directly with the converted value - the effect is the same. > is it this? In QtRuby, a slot can either be a normal Ruby method, or it can be a block. Maybe it is easier to understand if you connect a block directly to each dial's 'sliderMoved(int)' signal, like this: Un_form.dial.connect(SIGNAL('sliderMoved(int)')) do |farenheit| celcius = ((farenheit - 32) / 1.8).to_i puts "dial: #{farenheit} farenheit ==> #{celcius} celcius" Un_form.dial_2.value = celcius Un_form.spinBox_2.value = celcius end Un_form.dial_2.connect(SIGNAL('sliderMoved(int)')) do |celcius| farenheit = ((1.8 * celcius) + 32).to_i puts "dial_2: #{celcius} celcius ==> #{farenheit} farenheit" Un_form.dial.value = farenheit Un_form.spinBox.value = farenheit end The you don't need an intermediate Qt::Widget or Qt::Object to do the conversion calculations. Note that in QtRuby you can write 'setFoo(v)' methods like 'foo = v', and so Un_form.spinBox.setValue(farenheit) can also be written as: Un_form.spinBox.value = farenheit -- Richard