How does textWidth work exactly?
-
Hi, I'm trying to understand why QTextDocument setTextWidth doesn't give me the results i want. I want a maximum width all the time (using a QTextEdit and QTextBrowser). However now i just get the correct width some of the time and i can't figure out why it fails.
The documentation https://doc.qt.io/qt-6/qtextdocument.html#textWidth-prop mentions that if the text cannot be broken into multiple lines to fit into the specified text width it will be larger. So i assume that is what is happening... but why... Also on text that does fit correctly it changes to the maximum width, of the widget, after a window resize.
The following however almost does exactly what i want, change the widgets lineWrapMode from WidgetWidth to FixedWidgetWidth and set setLineWrapColumnOrWidth(). However now the text will not resize if the window becomes smaller than the specified size .