QLabel - visible text function or something else
hello,
I'm making something like music player and I'm using QLabel to display the track title.
Sometimes the track title is long and the result is:
http://img155.imageshack.us/img155/4849/qlabelxq8.png
I must create algorithm to show it all in parts. I want to ask: is there a function that return me only the visible text?
thanks all
Re: QLabel - visible text function or something else
Not sure of any such function.
I guess u want to show the whole text.
Would suggest 2 solutions -
1) Use setToolTip() to display the whole text
2) Inherit QLabel and make the text scrolling. Its easy. Set a fixed no of chars to display. Now display the string - fullString.mid(ith_position,no_of_chars_to_displaY ) using a QTimer .
Hope this helps :)
Re: QLabel - visible text function or something else
Yes, the scrolling is good method, but I don't know how many chars to display, because my form is resizable. May be I need to create funkction that calculate the chars from the label width.
Thank you...
Re: QLabel - visible text function or something else
There is such a function. Take a look at QFontMetrics::elidedText().