Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    How to find out if an item of QTreeView is visble or not?

    General and Desktop
    2
    2
    1189
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • V
      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, scrollTo will 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.

      1 Reply Last reply Reply Quote 0
      • Chris Kawa
        Chris Kawa Moderators last edited by

        You can use visualRect for that. It's gonna be invalid if the item is not visible.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post