Re: [Interest] Display nicely truncated text in a QLabel

2013-07-22 Thread Adam Light
On Fri, Jul 12, 2013 at 2:06 AM, wrote: > Hi > > I would derive from QLabel, get the length of it (in pixel) with > frameWidth() use QFontMetrics QWidget::fontMetrics () with int > QFontMetrics::width ( const QString & text, int len = -1 ) to get the > length of the text in pixels, check if it fi

Re: [Interest] Display nicely truncated text in a QLabel

2013-07-12 Thread Lucas.Betschart
Hi I would derive from QLabel, get the length of it (in pixel) with frameWidth() use QFontMetrics QWidget::fontMetrics () with int QFontMetrics::width ( const QString & text, int len = -1 ) to get the length of the text in pixels, check if it fits, and if no cut some chars and replace it with …

[Interest] Display nicely truncated text in a QLabel

2013-07-12 Thread Etienne Sandré-Chardonnal
Dear all, When maximumSize() is set on a QLabel, if the text is too long, it truncates it harshly (the rendered text pixmap is just trimmed). Is there a way to display the text nicely truncated with "..." or so at the end and no half-character? If not, this would really be something to implement