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. TreeViewDelegate is last child
Forum Updated to NodeBB v4.3 + New Features

TreeViewDelegate is last child

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 1 Posters 72 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.
  • M Offline
    M Offline
    Mihaill
    wrote last edited by Mihaill
    #1

    Hi!
    I use TreeView and TreeViewDelegate .
    How I can know that TreeViewDelegate is last child at he parent?
    This parameters can help only if parent don't expanded

                    console.log("-----------------------")
                    console.log("----parentChilds", parent.children.length)
                    console.log("-----row", row)
                    console.log("-----index", index)
                    console.log("-----modelIndex", treeView.index(row, column).parent)
                    console.log("-----parent childs", treeView.model.rowCount( treeView.index(row, column).parent ))
                    console.log("-----realRowParent",  rowAtIndex(treeView.index(row, column).parent))
                    console.log("-----realRow",  row - 1 - rowAtIndex(treeView.index(row, column).parent))
                    console.log("-----isItemLastInListAndInDepth", isItemLastInListAndInDepth)
                    console.log("----isItemLastInList", isItemLastInList)
                    console.log("----rowCountOfItem", rowCountOfItem)
                    console.log("----realRow + 1", realRow + 1)
    

    And it's can help only for small tree

                    var countRow = 0
                    for (var i = rowAtIndex(treeView.index(row, column).parent) + 1;  i < row; i++) {
                        if (depth === itemAtIndex(treeView.index(i, column)).depth) {
                            countRow++
                        }
                    }
                    console.log("-----countRow", countRow)
    

    Or how I can get last row child for parent?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mihaill
      wrote last edited by
      #3

      Possible find real row like that:
      realRow: treeView.index(row, column).row

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Mihaill
        wrote last edited by
        #2
        This post is deleted!
        1 Reply Last reply
        0
        • M Offline
          M Offline
          Mihaill
          wrote last edited by
          #3

          Possible find real row like that:
          realRow: treeView.index(row, column).row

          1 Reply Last reply
          0
          • M Mihaill has marked this topic as solved

          • Login

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