Results 1 to 12 of 12

Thread: Treeview scrollbar not updating when inserting rows

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Treeview scrollbar not updating when inserting rows

    Looks like QTreeView maintains its private "view items" structure which gets out of sync due to reimplemented QTreeView::rowsInserted(). Perhaps you should forget about reimplementing it and try to deliver the data in some kind of batches instead of continuous flow.
    J-P Nurmi

  2. #2
    Join Date
    Nov 2007
    Posts
    51
    Thanks
    2
    Thanked 2 Times in 2 Posts

    Default Re: Treeview scrollbar not updating when inserting rows

    Thats bad news, i really need to keep the flow as fast and as continuous as possible.
    I know of no other way of making only those items update which are visible, than that presented. Because this *has* to happen in order not to freeze up the gui, or keep the cpu continually at 100% when visually nothing happens. And this has the scrollbar problem.
    Do you have another solution suggestion, perhaps?

    Thanks very much for your assistance.

  3. #3
    Join Date
    Aug 2006
    Posts
    250
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    19
    Thanked 49 Times in 36 Posts

    Default Re: Treeview scrollbar not updating when inserting rows

    So updating at every received row is too much overhead, and updating never causes the scrollbars to be out of sync. So why don't you just update periodically? Update twice a second or so. Should keep the cpu usage manageable, and the scrollbars will be reasonably up to date..

    Although it sure sounds like there should be a better solution to this problem...

  4. #4
    Join Date
    Aug 2006
    Posts
    250
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    19
    Thanked 49 Times in 36 Posts

    Default Re: Treeview scrollbar not updating when inserting rows

    Also you can perhaps try minimizing the cost of updates by setting uniformRowHeight and making sure the header is not set to ResizeToContents

  5. #5
    Join Date
    Nov 2007
    Posts
    51
    Thanks
    2
    Thanked 2 Times in 2 Posts

    Default Re: Treeview scrollbar not updating when inserting rows

    Thank you, pherthyl, albeit a little late on my thanks
    I used most of your solutions, though i dont really know a correct way of forcing an update on the view every 1-2 seconds. Maybe by giving a model a list of visible mapped to source indexes(because i use a proxy model aswell) to emit dataChanged on all of them?
    I ended up buffering the row inserting on the model side, and emitting beginInsertRows/endInsertRows on every 20 inserts.

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.