0

I want to add headers for columns in my TreeView. Is there a way to do it in Qt6.3?

Currently, my qml looks like this:

TreeView {
    id: tree_view
    anchors{
        fill: parent
        margins: 10
    }

    model: FileSystemModel
    clip: true

    delegate: TreeViewDelegate {
        contentItem: Text {
            anchors.leftMargin: leftMargin
            anchors.rightMargin: rightMargin
            text: {
                if (column === 0)
                    file_name
                else if (column === 1)
                    inner_files
                else
                    file_size
            }
        }
    }
}

I cant use TableViewColumn because the compiler says that "it's not a type". I have already switched to Qt 6.3 from the 6.2 version because of the same problem with the TreeView component.

TreeView now (without headers)

m7913d
  • 10,244
  • 7
  • 28
  • 56
no name
  • 3
  • 2

1 Answers1

0

According to the documentation headers for TreeViews are not supported by QML.