2009/6/27 Keval Vora <[email protected]>: > > >> >> (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. >> > > Why? If QtCreator did not allow you to do it, means that particular SIGNAL > and SLOT are not directly compatible. > Now I made same application as you said, and I used the reject() signal of > button box and made my own slot myReject(). In myReject(), I simply wrote > ui->spinBox->setValue(0); > And I am done! I got the output, on click of reset, my values come down to > 0.
Could you send me that section of code, please? > >> >> 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". > > Yes, clear() slot is as you said, I checked that out while reading your > mail. > > (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? > > I don't think button box allows you to edit its labels. Use simple Push > Button instead and edit the text property. > :) > > Let me know it your thing runs, and if it does, please try solving mine > which I had posted earlier regarding resizing :) > > -- > Thanks & Regards, > Keval Vora. > > [Non-text portions of this message have been removed] > > -- Anirudh R (tarantinofan.wordpress.com) "There nearly always is method in madness. It's what drives men mad, being methodical."

