QTextEdit; adjustSize() not working?
-
setting text for QTextEdit:
te->setPlainText("Something") ;
te->adjustSize();should wrap around "Something" only , instead the TextEdit is expanding to its maximum Width-Height, can't fix it..
When I select "Something" on run time , only "Something" is highlighted, no added extra white spaces.Expectations: when text is small enough to fit on one Line, the text edit shouldn't expand in height, when the text needs to wrap , only the extra line width should be added not the maximum width.
if adjustSize(); is not called , the text will wrap on the width that was set in the .ui in the Creator , wont dynamically expand horizontally nor vertically..
Some Info:
Horizontal Policy: Expanding
Vertical Policy : MinimumExpanding
minimumSize : 2x22
maximum Size : 300x100
lineWrapMode: WidgetWidthAny Idea ?
-
Reimplement sizeHint() to take into consideration the size of the document and call update()
-
Thanks for your help :) but I solved it by calculating width and height and setting the geometry.