[Qt-interest] Increase QRadioButton indicator size?

Jason Tiller jason at sonos.org
Fri Jun 25 04:29:58 CEST 2010


Hi, All, :)

I apologize if this question has been asked and answered before (I did
a cursory search of the archives and only found one, unresolved
discussion from 2003) - this is my first post to qt-interest!

How can I increase the size of the indicator on a QRadioButton?  I
haven't had any luck with the simple mechanisms I tried.  Setting the
widget's stylesheet like so in PyQt4

style = \
'''QRadioButton::indicator {
       width: 100px;
       height: 100px;
    }" )
'''

caused the space *alotted* to the indicator (radio button) to be
expanded, but the size of the indicator didn't change.  The little
radiobutton was stuck in the top-left-hand corner of that huge space -
very lonely looking.

I fiddled with various positions, but while I could move the button
image around, I could never change its size.

Then I tried loading a .png file as the image.  Essentially, I added
this line:

    image: url(/home/jasont/experiments/style_radio_buttons/button.png);

Interestingly, the image was placed square in the center of the
100-pixel rectangle... but it also didn't expand in size.

The documentation seems to indicate that the only way I could get the
indicator to expand to fill the full space was to use SVG files.

I've implemented a crude radio button button manual painting, but
that's *far* from ideal.

Anybody have a suggestion as to how to perform this seemingly
obvious/trivial task?  I'm sure I'm missing *something*!

Thanks,

---Jason



More information about the Qt-interest-old mailing list