0
votes

I'm having problems with QTextEdit not shrinking below certain size. To be more precise. I have a widget with horizontal layout. This widget has two children, another container widgets. Each of this child widgets contain more or less the same elements (labels, QLineEdits, buttons,...). The only difference is, that the right container widget also has QTextEdit elements, right next to each other in another horizontal layout.

When the window is big enough, everything is positioned and sized correctly. The two container widget take 1/2 of the window each and the two QTextEdits take roughly 1/4 of the window each, all aligned properly. However, when the window gets small enough, the QTextEdits refuse to downsize, they keep constant width - breaking the proper alignment of the elements.

Have anyone ever encountered it? Do you know how to make the QTextEdits get smaller bellow the artificial threshold?

I was playing around with minimum size, various size policies. I've also looked into the Qt source of QTextEdit, QTextControl and QTextDocument to find some magical fixed minimal width to no success.

Attaching picture demonstrating the issue in Qt Designer Demonstration of QTextEdit ied minimal width in Qt Designer

1
I think there is a minimum-size property for every widget, try setting that to 0.sashoalm
Instead of setting the minimum width of your QTextEdit object to 0, try setting it to 1.thuga
can you mock something in designer and post the image? saves lots of explanation.UmNyobe
@Niklas: no code, unless you want to see Qt-generated code from the .ui fileDalibor Frivaldsky
@thuga: I tried setting it to a different value than 0 with no effectDalibor Frivaldsky

1 Answers

1
votes

The trick is to set the minimum width of the QTextEdits to 0 (zero) and change the horizontal size policy to Ignored.