[Qt-interest] squeeze a string for display

Colin S. Miller no-spam-thank-you at csmiller.demon.co.uk
Thu Jun 3 22:20:23 CEST 2010


Daniel Franke wrote:
> Hi all.
> 
> I want to compress/squeeze a string for display, but can't find the proper way 
> to do it.
> 
> 
> instead of increasing the widget, which is what I currently have:
> 
>       +------------------------------------------------------------+
>       | A string too long for this widget as it overruns the border|
>       +------------------------------------------------------------+
> 
> Could someone be so kind to point me to the appropriate section of the docs?
> I can't find anything myself.

What happens if you set the MaximumWidth/MaximumHeight properties of the qlabel/qgroupbox?
That will stop it from expanding. You can also do this in the containing
QGridLayout, if there is one.


I'm not sure if there is a way to stop a qgroupbox from expanding for its
label's size, not it.s contents size.

You could either
1) take a peek at the code.
2) layout the qgroupbox with no label, then lock its size, and finally set the label.

HTH,
Colin S. Miller





More information about the Qt-interest-old mailing list