Easier way to find (visual) position of QModelIndex in QTreeView
Asked Answered
C

1

10

I'm interested in calculating the physical position of a node in QTreeView and can't find a way to do this (other than calculating it myself, which is cumbersome and error prone given the robustness of QTreeView).

Is there a standard way of finding the draw position of data associated with a QModelIndex (something similar to the way indexAt() maps a position to a QModelIndex)?

Cancan answered 16/11, 2009 at 1:49 Comment(1)
No need to apologize---just answer your own question and accept the answer. That's encouraged behavior on Stack Overflow. Will even earn you the "self-learner" badge.Accretion
C
14

There's a method in QAbstractItemView that does exactly what I needed:

The signature is:

virtual QRect visualRect ( const QModelIndex & index ) const
Cancan answered 20/11, 2009 at 0:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.