Is there a way to wrap text in QCheckBox like it is done with QLabel?
label = QLabel( QString.fromUtf8('long text in here'))
label.setWordWrap(True)
I tried \n
which will add a linebreak but this is not dynamic if I resize the window.
It seems there is a feature request for this at https://bugreports.qt.io/browse/QTBUG-5370.
The issue is not closed, so likely this feature is not implemented. This means that it is not currently possible to add word wrap to QCheckBox.
You can try various workarounds, such as having an empty-text QCheckBox and a QLabel to the right, or try putting a shorter text for the checkbox, with a label below it with the long explanation.
You can develop a Custom widgets for QtDesigner to use this feature graphically (or not).
CheckBoxWordWrap
(dynamic when resize):
In QtDesigner:
You can also use the class and modify it if the behavior is not exactly what you want.
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