Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to find out if an item of QTreeView is visble or not?
Qt 6.11 is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.1k Views 2 Watching
  • 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 Offline
    V Offline
    Violet Giraffe
    wrote on last edited by Violet Giraffe
    #1

    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
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved