Results 1 to 4 of 4

Thread: QTreeWidget - scrolls to top when removing items

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2006
    Location
    Germany
    Posts
    84
    Thanks
    5
    Thanked 5 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QTreeWidget - scrolls to top when removing items

    Hello,
    I have a very annoying problem (4.2.1). I have alot of items in my treewidget and the user can select an item and remove it from the view. I just call QTreeWidget::takeTopLevelItem(index) and the item gets removed BUT assuming the item was somewhere down the list and after removing it, the treewidget automatically scrolls to the top of the list.

    I even tried this:

    Qt Code:
    1. int y = treewidget->verticalScrollBar()->value();
    2. treewidget->takeTopLevelItem(index);
    3. treewidget->verticalScrollBar()->setValue(y);
    To copy to clipboard, switch view to plain text mode 

    But it doesn't make any difference. I also dumped the variable y into a file and it always said valid values like 863, 672 ...

    It's really annoying and in Qt3/QListView this never happened. Thank you guys.
    Last edited by durbrak; 25th November 2006 at 14:30. Reason: updated contents

Similar Threads

  1. Removing items properly from qtreewidget item
    By Djony in forum Qt Programming
    Replies: 6
    Last Post: 21st November 2006, 12:20
  2. resizing a QTreeWidget
    By drhex in forum Qt Programming
    Replies: 6
    Last Post: 27th October 2006, 22:32
  3. Replies: 1
    Last Post: 21st September 2006, 10:37
  4. Selective highlighting of Items
    By Kapil in forum Qt Programming
    Replies: 3
    Last Post: 26th May 2006, 12:20

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.