Results 1 to 3 of 3

Thread: QListView with conditional vertical automatic scroll

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2009
    Posts
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question QListView with conditional vertical automatic scroll

    I am trying to achieve a console like behaviour to a QListView where everytime the vertical scroll bar is set all the way to the bottom and a new item is added, scroll it so that the new item is visible.

    I came up with this piece of code put where every new item is added:

    Qt Code:
    1. if (QListView::verticalScrollBar()->value() == QListView::verticalScrollBar()->sliderPosition())
    2. {
    3. QListView::scrollToBottom();
    4. }
    To copy to clipboard, switch view to plain text mode 

    Problem is, even tho tracking is enabled on the QAbstractScrollBar widget, I always get value() and sliderPosition() with the same value making the QListView always scroll down.

    Is this the best way out of this? If not, what should be my solution? If it is, what am I missing that make those 2 values identical no matter what?

  2. The following user says thank you to jmesquita for this useful post:

    wendelmaques (6th January 2011)

Similar Threads

  1. QListView scroll height (solved)
    By efegea in forum Qt Programming
    Replies: 0
    Last Post: 26th April 2009, 14:06
  2. Vertical scroll bar, but resizable horizontal content
    By minimoog in forum Qt Programming
    Replies: 0
    Last Post: 14th January 2009, 20:51
  3. vertical scroll bar in Qt box.
    By rajveer in forum Qt Programming
    Replies: 1
    Last Post: 22nd October 2008, 07:41
  4. Vertical Scroll Bar - Style Sheet
    By vishesh in forum Qt Programming
    Replies: 2
    Last Post: 18th September 2007, 19:03
  5. Automatic scroll in graphics view
    By Morea in forum Qt Programming
    Replies: 1
    Last Post: 18th November 2006, 14:07

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.