From 10:00 CET Friday 22nd November we will adjust how the server works to deal with some recently reported problems. Therefore there may be a load problem, if you experience more problems than usual trying to access the forum then please PM AndyS or any of the moderators so they can inform me.


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