Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to find out if an item of QTreeView is visble or not?
Violet Giraffe last edited by Violet Giraffe
I need to ensure an item is visible. I do that by calling
scrollTo. The problem is, even if the item was visible,
scrollTowill still scroll the view slightly so that the item in question is at the bottom of the view region - even though I use the default second parameter,
QAbstractItemView::EnsureVisible. I want to avoid that unneccessary movement, which I can do by not calling scrollTo in the first place if I don't have to.
You can use visualRect for that. It's gonna be invalid if the item is not visible.