PDA

View Full Version : Unchecking QRadioButton



gruszczy
25th February 2008, 17:56
First of all - hello everyone :-)

I would like to make QRadioButton, that would function as QCheckBox (for aesthetic reasons). I checked class description and inherited methods, but failed to find single method, that is called, when QRadioButton is pressed. I tried to use click() slot, but it doesn't seem to be called, when I press this button. I need to be able to uncheck it, when someone clicks on checked button, therefore I need to intercept this call. Could anyone tell me, which method should I subclass?

I guess, I must use some event. If I simply call click() slot in the code, everything works just fine. But I don't know, what needs to be subclassed, when the button is clicked.

wysota
25th February 2008, 18:00
I would like to make QRadioButton, that would function as QCheckBox (for aesthetic reasons).
You mean "unintuitive"?


Could anyone tell me, which method should I subclass?
Subclass QCheckBox and reimplement paintEvent. Use QStyle API to draw the button as it would be a radio button.

codeslicer
25th February 2008, 22:54
Why not use Qt Style Sheets (http://doc.trolltech.com/latest/stylesheet.html)? You can make the QCheckBox look like a QRadioButton I think...

But reimplementing it is also a way.

wysota
26th February 2008, 00:55
Oh, by the way. Before you do anything complicated try changing the "autoExclusive" property of the radio button to false. I think it should get you your holy grail.