In my application, I have a horizontal slider (QSlider), a spin box (QSpinBox), and a button box with "OK" and "Cancel" (QDialogButtonBox).
(a) Signals and slots I have set a valueChanged(int) signal from the slider to the setValue(int) slot on the spinbox, and vice-versa, so that the slider and the spinbox values are coordinated. My next objective is to reset the values of the spinbox and the slider to 1 when I click on "Cancel". I am sending a rejected() signal from the button box to the setValue(1) slot on the slider and on the spinbox. The setValue(int) slot was not allowed by QtCreator's signals and slots editor, so I hand-edited the .ui file to get it. As I half-expected, it is not working. Why am I unable to do this and how do I achieve this objective? I know I can't do setValue(1), but I want the values of the spinbox and the slider to reset and I was hoping that it would work. :) I tried setting a clear() slot on the spinbox, but that only clears the value. If the spinbox holds a value of "x" and I click on "Cancel", the value gets cleared to a blank. If I then press the increase button, the value on the spinbox is "x+1", not "1". There is no clear() slot for the slider, and in fact, there seem to be no QSlider slots in conjunction with the QDialogButtonBox rejected() signal, only QWidget slots. The slider-spinbox coordination is not working for this. There is a QWidget slot called "update()", which I thought would refresh the slider's value in accordance with the slider-spinbox coordination, but it did not. (b) Button label editing On QDialogButtonBox, I do not want "Cancel", but instead I want "Reset". How do I achieve this? Hand-editing the .ui file and changing "Cancel" to "Reset" gives me a build failure. (I think because the value is a variable name, not a string! It was not in quotes!) Do I have to use something other than QDialogButtonBox? Anirudh R

