Results 1 to 2 of 2

Thread: scroll on QAbstractItemView layout changes

  1. #1
    Join Date
    Nov 2009
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default scroll on QAbstractItemView layout changes

    I would like to call scrollTo(currentIndex()) after a view has done a layout following a layoutChanged signal from the model but can't see a way to queue this. I can't connect to the same model signal since it would be likely to scroll before the layout is complete. The layout functions of the views are private or non-virtual and I can't see how else to determine when the layout is complete. I'm sure I'm missing something obvious here since it must be a common requirement.

    In my case I am using a QListView and am emitting layoutChanged() when the icons returned by the Qt::DecorationRole have changed size.

    thanks.
    Last edited by ibex; 29th November 2009 at 23:31. Reason: disable smilies

  2. #2
    Join Date
    Nov 2009
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: scroll on QAbstractItemView layout changes

    Looks like overriding QAbstractItemView::updateGeometries() introduced in Qt4.4 to do the scrollTo() is the answer. I'm not sure it is the correct way but it seems to work.

Similar Threads

  1. QScrollArea: clearing the layout of the inner widget
    By mattc in forum Qt Programming
    Replies: 1
    Last Post: 3rd August 2009, 08:09
  2. Qt like Layout Manager available for .NET platform
    By vkhaitan in forum Qt Programming
    Replies: 0
    Last Post: 5th November 2008, 13:36
  3. how to add scroll bar on QGridLayout in QT??
    By sharvari in forum Newbie
    Replies: 3
    Last Post: 19th February 2008, 14:31
  4. Qt layout memory issue
    By bunjee in forum Qt Programming
    Replies: 9
    Last Post: 25th August 2007, 17:11
  5. QScrollArea's Scroll Bars
    By ToddAtWSU in forum Qt Programming
    Replies: 5
    Last Post: 19th September 2006, 13:27

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.