0

I'm developing an MCQ app with long text options and just now discovered that the QRadioButton doesn't have Wordwrap option like QLabel. I'm getting my sentences truncated. Is there any way to implement this?

enter image description here

I tried using CSS with word wrap = "break-word" but it didn't work.

I also tried to use QTextBrowser with html but it does not support Radio Buttons input type="radio"

Thx,

Silvio Duarte
  • 41
  • 1
  • 5
  • so on python I can't answer you that. you can custom draw the text with word warp. that would be `Qt::TextWordWrap`. but you can also use `QFontMetrics` to create it for you automatically. the width of the text gives you the method fontMetrics().horizontalAdvance("getwidthsize"). So the code could look like this. painter.drawText(0,0,painter.fontMetrics().height(), painter.fontMetrics().horizontalAdvance("text"), Qt::TextWordWrap, "text"); However, you must note here that only the font size is returned when wrapping. So not the full height of the text – BanAnn Jan 12 '23 at 21:11
  • You can also just not assign any text to the button and just use QLabel. – Alexander Jan 12 '23 at 22:14

0 Answers0