PDA

View Full Version : QTreeWidget - scrolls to top when removing items



durbrak
25th November 2006, 14:29
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:


int y = treewidget->verticalScrollBar()->value();
treewidget->takeTopLevelItem(index);
treewidget->verticalScrollBar()->setValue(y);

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.

jpn
25th November 2006, 17:48
This indeed feels like a nasty bug. Have you reported this to the Trolls?

durbrak
25th November 2006, 19:35
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?

drhex
26th November 2006, 22:02
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).