TableView HeaderDelegate CheckBox can't be checked



  • Hi all
    I have small problem with headerDelegate
    CheckBox than I placed at header can't be checked
    even MouseAria can't be clicked on header
    looks like something catch mouse action
    but I see that CheckBox changed when button pressed
    so I have no idea ((
    thanks for any help

    import QtQuick 2.2
    import QtQuick.Controls 1.4
    import QtQuick.Controls 2.0
       
     TableView {
            id: tvMain
            parent: svMain
    
            anchors.fill: parent
            frameVisible: false
            sortIndicatorVisible: true
            model: mainModel
            headerDelegate: aldHeader
    
            TableViewColumn {
                id: tvcDeployment
                title: dict.getStringByCode("Deployment")
                role: "d"
                movable: false
                delegate: aldJira
                width: 100
            }
    
            // more columns
    
            rowDelegate: Rectangle {
                height: 30
                color: styleData.selected ? "skyblue" : (styleData.row % 2 == 0 ? "whitesmoke" : "white")
            }
    
    
            Component {
                id: aldHeader
    
                Rectangle {
                    id: rHeader
                    height: 30
                    color: "lightsteelblue"
                    border.color: "lightgrey"
                    border.width: 1
    
                    MouseArea {
                        id: maHeader
                        anchors.fill: parent
                        z: 100
                        onClicked: {
                            // following line never appear in console
                            console.log("maHeader.onClicked", styleData.column, styleData.value);
                        }
                    }
    
                    Text {
                        id: tHeader
                        anchors.centerIn: parent
                        text: styleData.value
                    }
                    
                    CheckBox {
                        id: cbHeader
                        anchors.centerIn: parent
    
                        onClicked: {
                            // following line never appear in console
                            console.log("changeStateForAll", styleData.column, styleData.value);                        
                        }
                    }
    
                    Component.onCompleted: {
                        console.log("tHeader.onCompleted", tHeader.width, width, styleData.column, styleData.value);
                        if ((styleData.column === 10) || (styleData.column === 9) || (styleData.column === 8)) {
                            cbHeader.visible = true;
                            tHeader.visible = false;
                        } else {
                            cbHeader.visible = false;
                            tHeader.visible = true;
                        }
                    }
                }
            }
        }
    


  • I should train my google skills))
    https://forum.qt.io/topic/67707/tableview-with-checkbox-in-header/5
    it's work


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.