Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use QWidget::scroll
Forum Updated to NodeBB v4.3 + New Features

How to use QWidget::scroll

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    maxg0
    wrote on last edited by
    #1

    Hi,

    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 *)
    {
    scroll(mScrollValue, 0);
    }@

    where "mScrollValue" is initialised to zero and then updated by another function call.
    I have two issues with what I have done so far:

    1. 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:

    1. 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
    M

    1 Reply Last reply
    0
    • N Offline
      N Offline
      NicuPopescu
      wrote on last edited by
      #2

      Hi,

      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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved