Results 1 to 4 of 4

Thread: QTreeWidget - scrolls to top when removing items

  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 15:30. Reason: updated contents

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

    Default Re: QTreeWidget - scrolls to top when removing items

    This indeed feels like a nasty bug. Have you reported this to the Trolls?
    J-P Nurmi

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

    Default Re: QTreeWidget - scrolls to top when removing items

    Well, I did now
    I hope this bug (=when adding items the treewidget doesn't scroll anywhere) will be fixed soon and they release 4.2.2 cos I can't wait a couple of months until 4.3.0.

    I'm curious though if anyone is able to reproduce this behavior?

  4. #4
    Join Date
    Jan 2006
    Location
    Knivsta, Sweden
    Posts
    153
    Thanks
    30
    Thanked 13 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Reproduced

    Tried it in my app where I also can remove QTreeWidgetItems. Yup - it scrolls to the top when removing a top level item (but not when removing other items).

Similar Threads

  1. Removing items properly from qtreewidget item
    By Djony in forum Qt Programming
    Replies: 6
    Last Post: 21st November 2006, 13:20
  2. resizing a QTreeWidget
    By drhex in forum Qt Programming
    Replies: 6
    Last Post: 27th October 2006, 23:32
  3. Replies: 1
    Last Post: 21st September 2006, 11:37
  4. Selective highlighting of Items
    By Kapil in forum Qt Programming
    Replies: 3
    Last Post: 26th May 2006, 13: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.