PDA

View Full Version : Smooth Text Scrolling



Jones
21st April 2010, 03:39
Hi,

Imagine a label with a fixed size containing a single-line text string which is too wide to fit inside the label. I need to design a widget which shows the complete text string by scrolling the text string from right to left - similar to a horizontal moving banner. I realize I may be able to use a hidden horizontal scroll bar with a timer but I was hoping there was a better way to do this. Any idea would be most appreciated.

Thanks,
Jones

Qt 4.5 / Qt Embedded

Lykurg
21st April 2010, 06:59
If it is only a label with text, I would do all the painting myself in a subclassed QLabel or even in a simple QWidget. Or you can alter QLabel and use QWidget::scroll() with a timer.

Jones
22nd April 2010, 05:57
Thanks Lykurg, I ended up creating a simple QWidget and using scroll() as you suggested. Works like a charm :-)

ragha4u
30th October 2010, 08:29
can u please post ur code

marco.stanzani
12th March 2011, 18:03
how can i do this (adding a scroll bar to a label) from Qt designer? I see that a scroll bar widget is available from Qt designer, still, no example or help is abailable ...
thanks

Lykurg
12th March 2011, 18:14
The tread wasn't about adding a scroll bar to a label, it was about using QWidget::scroll() which is a different case... What so you exactly want? I guess you are looking for QScrollArea with a QLabel inside.

marco.stanzani
15th March 2011, 17:52
i solved the problem by using a Qtextedit widget which provided hori and vert scroll bars 'as nedded'

thx

Marwa Shams
25th July 2011, 01:07
If it is only a label with text, I would do all the painting myself in a subclassed QLabel or even in a simple QWidget. Or you can alter QLabel and use QWidget::scroll() with a timer.


I want to make a label that contains rich text ,but the text is larger than the label size.
So, I need to have a scroll bar with the label.

How can I " alter QLabel and use QWidget::scroll() with a timer " ??
I don't understand how to implement this :(

Lykurg
25th July 2011, 10:08
So, I need to have a scroll bar with the label.Then it is what I said to marco.stanzani: You are looking for QScrollArea. See the detailed description and you find an example on how to use it.

Marwa Shams
29th July 2011, 14:39
Then it is what I said to marco.stanzani: You are looking for QScrollArea. See the detailed description and you find an example on how to use it.

Thank you very much :)

Marwa Shams
5th August 2011, 15:44
I already added the label to a scroll area ..
It works well that the scroll area has a scroll-bar vertical and horizontal
when the height and width of the label is larger than the height and width of the scroll area .......... BUT

the problem now with the label itself .. that the label doesn't expand its height depending on its content .
for example:- If the height is 20 pix then one line of text only appeared .. although there is another 3 lines that doesn't appear
So .. what is the way to make the label scaled to its content vertically??:confused:

cw9000
19th November 2011, 19:40
for the original post: scrolling text like a banner with Qlabel.
go here for some answers.
another qt centre post (http://www.qtcentre.org/threads/45567-PyQt4-Smooth-text-scrolling-in-QLabel-%28again%29)