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. Qt 6.4 Treeview in qml
Forum Updated to NodeBB v4.3 + New Features

Qt 6.4 Treeview in qml

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 278 Views 1 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.
  • T Offline
    T Offline
    tuno
    wrote on last edited by
    #1

    I want to create treeview using qt 6.4 in QT Design Studio but indicator not visible. Please help me with the implementation.

    My code:

    import QtQuick 6.4
    import QtQuick.Controls 6.4
    import Qt.labs.folderlistmodel 2.1
    import QtQuick.Studio.Components 1.0
    
    TreeView {
        id: folderSystemView
        x: 0
        y: 0
        width: 412
        height: 500
        clip: true
        model: FolderListModel {
            id: folderModel
            folder: "file:///E:"
            nameFilters: ["*"]
            showDirs: true
        }
        delegate:TreeViewDelegate {
            id: control
            background: Rectangle {
                implicitHeight: 40
                color: control.highlighted
                       ? control.palette.highlight
                       : (control.treeView.alternatingRows && control.row % 2 !== 0
                       ? control.palette.alternateBase : control.palette.base)
            }
            indicator: SvgPathItem{
                height:40
                width:40
                fillColor: "#000000"
                path: "M350.45,277.5l-164.08,94.73c-16.55,9.56-37.24-2.39-37.24-21.5V161.27c0-19.11,20.69-31.06,37.24-21.5
                l164.08,94.73C367,244.06,367,267.94,350.45,277.5z"
            }
    
            contentItem: Label {
                clip: false
                text: model.fileName
                elide: Text.ElideRight
                color: control.highlighted ? control.palette.highlightedText : control.palette.buttonText
                visible: !control.editing
            }
        }
    }
    
    
    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