首页 > 解决方案 > 自定义 TableViewColumn 委托问题

问题描述

我的自定义委托有几个问题TableViewColumn。这是我的TreeView:

    TreeView {
        id: view
        anchors.fill: parent
        sortIndicatorVisible: true
        model: fileSystemModel
        rootIndex: rootPathIndex
        selection: sel
        selectionMode: 2

        TableViewColumn {
            id: namecolumn
            title: "Name"
            role: "fileName"

            resizable: true
            width: parent.width-sizeWidth-dateWidth-scrollBarWidth
            delegate: ItemDelegate {
                id: fileCheckDelegate
                Row{

                    CheckBox{
                        id: cbox

                          visible: (model.isDir==true) ? false : true

                    }
                    Text{
                        id: itext
                        text: model.fileName
                        width: namecolumn.width-itext.x-cbox.width
                        elide: Text.ElideRight

                    }
                 }
                ToolTip {
                    parent: fileCheckDelegate
                    visible: hovered
                    delay: 1000
                    text: qsTr(model.fileName)
                }
            }

        }
        TableViewColumn {
            id: sizecolumn
            title: "Size"
            role: "size"

            resizable: false
            width: sizeWidth

        }

        TableViewColumn {
            id: datecolumn
            title: "Date Modified"
            role: "lastModified"
            width: dateWidth
            resizable: false

        }
    }

问题如下图所示:

谢谢你的帮助,

有问题的 TreeView

标签: qtqml

解决方案


推荐阅读