I'm trying to have a multi-line checkbox/radiobutton with Qt using standard QCheckbox/QRadioButton.
I didn't find the direct solution since QRadioButton{wrap:true;}
has no effect.
The only thing possible would be to access to the QRadioButton->label->setLineWrap(true)
but
Any idea beside putting a QRadioButton and a QLabel next to each others?
Thx, Boris.
That indeed is really annoying and cannot be solved without reimplementation: the label uses Qt::PlainText
if I'm not mistaken. In our projects, the UI team solved this with two approaches.
Using the QRadioButton button as a title
Rewrite the QRadioButton text in such a fashion that it has only a brief description of the option. Put a QLabel underneath it and add a longer description. We use a smaller font and a little indentation to make it look neat. This is used frequently in Mac OS X, for example.
Removing the text from the radio button
Relayout the UI so that each radio button is put on the left of a QLabel. Add the whole text to the QLabel and set the label as the radio buttons' buddy. This is the least functional approach, because clicking the label does not check the radio button. Also, alignment is not very good.
The only way I know (but it's not "layoutable") is putting \n sign into a string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With