TreeView's item delegate receiving empty strings as styleData.value



  • Hi,

    I noticed a weird behavior of the delegates in TreeView's and TreeViewColumn's : the styleData.value sometimes is an empty string, no matter the type of the item it should receive.

    For instance, if you take the 'Qt Qui Controls - File System Browser' example, and you modify slightly the the Name column:

        TableViewColumn {
            title: "Name"
            role: "fileName"
            resizable: true
    
            delegate: Text {
                text: {
                    console.log(this, styleData.value);
                    return styleData.value;
                }
            }
        }
    

    It will output the following:

    qml: QQuickText(0xb30c310) C:
    qml: QQuickText(0xb30c310) C:
    qml: QQuickText(0xb303090) 
    qml: QQuickText(0xb303090) G:
    qml: QQuickText(0x59e82f0) 
    qml: QQuickText(0x59e82f0) E:
    qml: QQuickText(0x4b89250) 
    qml: QQuickText(0x4b89250) D:
    qml: QQuickText(0xb30c310) C:
    qml: QQuickText(0xb303090) G:
    qml: QQuickText(0x59e82f0) E:
    qml: QQuickText(0x4b89250) D:
    

    It doesn't really make sense to me ... why would the delegate corresponding to my C: item be called 3 times with the correct fileName while the delegate for the G: drive is called once with an empty string, and twice with the correct fileName ?

    Any idea what's going on ?


Log in to reply
 

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