Skip to content

KSqueezedTextLabel::sizeHint(): Use horizontal advance instead of bounding rect

Noah Davis requested to merge work/ndavis/ksqueezedtextlabel-clipping-bug into master

Using the bounding rect causes the side opposite to the alignment (right width AlignLeft, left with AlignRight) to get clipped off sometimes. Switching to horizontal advance fixed the issue.

This is needed for graphics/gwenview!54 (merged), which is also what I was testing this patch with. These are the non-default parameters I was testing with:

  • text: "Background color:"
  • alignment: Qt::AlignRight | Qt::AlignVCenter
  • elide mode: Qt::ElideRight
  • contents margins: 4, 0, 4, 0
Edited by Noah Davis

Merge request reports