PDA

View Full Version : QLabel text and ElideMode (...)



Talei
7th May 2010, 19:27
Hello,
Is it possible to somehow set elide mode for text in QLabels?
I have a lot of text (path with filename) that are displayed, and I wonder if it is possible to i.e. show instead of
"/home/username/workfiles/year2010/works/may/19/filename.jpg"
something like:
".../works/may/19/filename.jpg"

Regards

Lykurg
7th May 2010, 20:04
See QxtLabel (http://doc.libqxt.org/0.6.0/qxtlabel.html) or do it yourself...

aamer4yu
8th May 2010, 06:11
You can get the eldied text via QFontMetrics::elidedText and set it on the label
Or alternatively you can subclass QLabel, override the setText function and set elided text from that function.

Talei
8th May 2010, 18:54
Thank you,
QxtLabel also use QFontMetrics so I kind of figure it out yesterday.

Regards