[Interest] QLabel inconsistent sizing with word wrap
alexander golks
alex at golks.de
Fri Jul 18 10:22:25 CEST 2014
Am Fri, 18 Jul 2014 17:45:48 +1000
schrieb "Tony Rietwyk" <tony at rightsoft.com.au>:
> > Am Fri, 18 Jul 2014 11:59:15 +1000
> > schrieb "Tony Rietwyk" <tony at rightsoft.com.au>:
> >
> > > Hi Everybody.
> > >
> > > In my Qt 4.8.6 application I cannot understand why this QLabel
> > > widget's sizing varies wildly depending on the text content - even for
> > similar text!
> > > The QLabel has only WordWrap switched on, and Alignment Top/Left. All
> > > of the widgets shown have size policy Preferred, except for the top
> > > level with the black border that has horizontal and vertical both set
> > > to MinimumExpanding. I've checked the source records and both
> > > descriptions are plain text without any line breaks, etc.
> > >
> > > There are lots of hits when googling, but few answers.
> > >
> > > Can anyone shed light on this? Has the text layout code been improved
> > > in v5?
> > >
> > > Regards,
> > >
> > > Tony
> >
> > hi,
> >
> > i assume your yellow marked text is the QLabel in question.
> >
> > as your whole layout (QFrame?) is smaller in the 2nd screenshot, it would
> be
> > only reasonable for the QLabel inside this layout to resize as well, or
> not?
> >
> > alex
>
> Hi Alex,
>
> Thanks for your reply. The outer frame layout resizes according to the
> internal sizes, including the highlighted QLabel, as I select different
> records from the list on the left. Most records return the narrower size,
> regardless of whether they have 2 or 6 lines of text. Hard to see why the
> sizeHint from the QLabel would be so different for the two records shown.
>
> Regards,
>
> Tony
hi,
i am not a specialist in layouts, there are a mysterium to me often, too, but;
why let the outer frame resize to according to the inner content? in your case i think i would attach it to the widget's size. it seems unnatural to me, to have the whole outer layout resize according to the size of the label.
alex
--
/*
* Excellent time to become a missing person.
*/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140718/5bb4bc53/attachment.sig>
More information about the Interest
mailing list