Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] Scroll to item in TreeView
QtWS25 Last Chance

[Solved] Scroll to item in TreeView

Scheduled Pinned Locked Moved QML and Qt Quick
treeviewqmlscrolling
2 Posts 1 Posters 3.8k Views
  • 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.
  • P Offline
    P Offline
    Precitec
    wrote on 24 Sept 2015, 09:48 last edited by Precitec
    #1

    Hi All,
    Scroll to an item in a TreeView by means of code in c++ or qml, that is what i'm trying to do.
    I have a TreeView and a "searchbox", a TextField and 2 Buttons, in the same view.
    After a successfull search i select the target item by code in c++ and qml.
    Selecting the item works fine but i can't find a way to set the scroller to an appropriate Position.
    In a ListView i could use the currentIndex property for programmed Scrolling, but currentIndex is readonly on the TreeView.

    Any Idea?
    Thanks

    P 1 Reply Last reply 28 Sept 2015, 11:27
    0
    • P Precitec
      24 Sept 2015, 09:48

      Hi All,
      Scroll to an item in a TreeView by means of code in c++ or qml, that is what i'm trying to do.
      I have a TreeView and a "searchbox", a TextField and 2 Buttons, in the same view.
      After a successfull search i select the target item by code in c++ and qml.
      Selecting the item works fine but i can't find a way to set the scroller to an appropriate Position.
      In a ListView i could use the currentIndex property for programmed Scrolling, but currentIndex is readonly on the TreeView.

      Any Idea?
      Thanks

      P Offline
      P Offline
      Precitec
      wrote on 28 Sept 2015, 11:27 last edited by
      #2

      @Precitec
      Managed it myself.
      Found code in TableView source i could use for TreeView:

      function positionViewAtRow(row, mode) { __listView.positionViewAtIndex(row, mode) }

      1 Reply Last reply
      1

      2/2

      28 Sept 2015, 11:27

      • Login

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