Unsolved Setting a QTreeWidget's current item to the last item does not set the scrollbar to its max value
-
Mac OS X 10.13.6
Qt 5.11.2If you set a QTreeWidget's current item to the last item, the scrollbar's value is set to maximum-1 rather than maximum.
Does anyone know why this is, or if there's any way to make it actually go to the max?
tree->setCurrentItem(tree->topLevelItem(tree->topLevelItemCount()-1));
The above will always set the scrollbar's value to maximum-1.
qDebug() << tree->verticalScrollBar()->value() << tree->verticalScrollBar()->maximum()
-
Hi,
What if you use QTreeWidget::scrollToItem ?
-
@SGaist Produces the same result, maximum - 1.
This got changed at some point in Qt5. In Qt4.8, it worked as you would expect.
I tested the different ScrollHints:
- Default EnsureVisible is max-1
- PositionAtTop correctly is set to max
- PositionAtBottom max-1
-
Can you check with the latest 5.12 to see if you have the same behaviour ?