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. ReferenceError error after calling TreeView.forceLayout in Qt 6.5
Forum Updated to NodeBB v4.3 + New Features

ReferenceError error after calling TreeView.forceLayout in Qt 6.5

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 113 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by A Former User
    #1

    I have a tree view in a popup. The code looks like this:

    Popup {
        id: root
        
        TreeView {
            id: treeView
            ......
    
            model: myModel
            delegate: TreeViewDelegate {
                indicator: Image {
                    ......
                    MouseArea {
                        .....
                        onClicked: {
                            if (myModel.canFetchMore(index)) {
                                myModel.fetchMore(index);
                            }
                            treeView.expand(row);
                            treeView.forceLayout();
                            // Got **ReferenceError: treeViewItem is not defined** in the next line
                            treeView.positionViewAtRow(row, TreeView.AlignTop);
                
                            // If I call some property in root, it will report **ReferenceError: root is not defined**
                         }
                    }
                }
            }
        }
    }
    

    Does anyone know the reason of the error?
    Thanks in advance.

    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