How to use QWidget::scroll
I need to add a "Ticker Tape" to my QT GUI. I am currently using a class which inherits from QWidget and which contains a bit of text for now (this will be replaced by a proper tape showing degrees).
I have managed to achieve the scrolling effect by invoking the scroll function within the paintEvent of my class
@void TickerTape::paintEvent(QPaintEvent *)
where "mScrollValue" is initialised to zero and then updated by another function call.
I have two issues with what I have done so far:
- I should be able to scroll for an accuracy at least of 0.5 degrees, whilst scroll only allows scrolling by an integer value. I could use some ad-hoc rescaling of the banner and perhaps achieve the 0.5 accuracy from the user point of view, but before I do this, is there another function or an extension of "scroll" that does what i want?
More IMPORTANT ISSUE:
- I need the text to appear a bit like a ribbon. Is there a way in which I can perform an inline wrap of the text?
I need the end of the text to appear on the left of the beginning of the left when they are both in the field of view. All I have found so far is setWordWrap on a QLabel, but this doesn't seem to have anything to do with what I want to achieve.
Many Thanks for your help
may be you'll find an answer at "Wheel Scroller Example":http://qt-project.org/doc/qt-5.0/qtwebkitexamples/webkitwidgets-scroller-wheel.html
for text wrapping I think you should manipulate the text in paintEvent