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)?

Marc Mutz - mmutz
  • 24,485
  • 12
  • 80
  • 90
Dan O
  • 4,323
  • 5
  • 29
  • 44
  • 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. – balpha Nov 19 '09 at 13:13

1 Answers1

14

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

The signature is:

virtual QRect visualRect ( const QModelIndex & index ) const
Marc Mutz - mmutz
  • 24,485
  • 12
  • 80
  • 90
Dan O
  • 4,323
  • 5
  • 29
  • 44