Results 1 to 4 of 4

Thread: Scroll bar jumps to the top after editing value.

  1. #1
    Join Date
    Jun 2008
    Posts
    89
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Scroll bar jumps to the top after editing value.

    Hi,

    I have a Qwidget which is promoted to MyTreeView.
    MyTreeView is derived from QTreeView. In the class MyTreeView i have delegates for the rows.. set through the function SetItemDelegateForColumn();
    The data in the MyTreeView is populated from MyProxyModel.
    Every thing works fine.. data is lengthy and scrollbar is shown for the view.
    Now the issue is when i edit any entry in the MyTreeView.. the scrollbar jumps to the begining after pressing enter.

    Please help.
    Regards,
    GK

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Scroll bar jumps to the top after editing value.

    Could it be that you reset the entire model when you have edited the value? You could overcome this by ensuring that your index is visible: http://doc.trolltech.com/4.5/qtreeview.html#scrollTo .

  3. #3
    Join Date
    Jun 2008
    Posts
    89
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Scroll bar jumps to the top after editing value.

    Hi e8johan,

    I have already tried scrollTo(index) function.
    I emited the signal from setData() function and in the slot i do scrollTo(index) but the app crashes in scrollTo() function.

    What can be the reason or is there any other solution?

    Regards,
    Gk

  4. #4
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Scroll bar jumps to the top after editing value.

    I'd say that the reason is that the proxy model that you use resets the entire model after editing... try editing without having the proxy model there and see if the behaviour improves. In that case you need to fix the proxy model.

Similar Threads

  1. Custom Scroll Widget Sizing Problem
    By sepehr in forum Qt Programming
    Replies: 2
    Last Post: 28th November 2008, 11:42
  2. how to add scroll bar on QGridLayout in QT??
    By sharvari in forum Newbie
    Replies: 3
    Last Post: 19th February 2008, 14:31
  3. ListWidget horizontal scroll.
    By patrick772goh in forum Qt Tools
    Replies: 3
    Last Post: 17th July 2007, 07:32
  4. QScrollArea's Scroll Bars
    By ToddAtWSU in forum Qt Programming
    Replies: 5
    Last Post: 19th September 2006, 13:27
  5. Retrieving offsets of scroll in QWorkspace
    By hardgeus in forum Qt Programming
    Replies: 6
    Last Post: 9th May 2006, 02:25

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.