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. TreeView's item delegate receiving empty strings as styleData.value

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

Scheduled Pinned Locked Moved QML and Qt Quick
treeview
1 Posts 1 Posters 898 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.
  • C Offline
    C Offline
    Citron
    wrote on last edited by
    #1

    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 ?

    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