Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-138397

QML TreeView will not update size when implicit size of TreeViewDelegate changes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.9.1
    • Quick: Controls 2
    • None
    • All

    Description

      when implicitWidth of TreeViewDelegate changes, TreeView will not update automatically.

      for example, modify the viewDelegate in the tableofcontents example:

       

      viewDelegate:
      onImplicitWidthChanged: {
          console.log("implicitWidthChanged")
      }

       

      contentItem: Label {
          id: label
          x: viewDelegate._padding + (viewDelegate.depth + 1 * viewDelegate.indentation)
          width: parent.width - viewDelegate._padding - x
          property bool flag: false
          TapHandler {
              onTapped: {
                  console.log("tapped")
                  label.flag = !label.flag
              }
          }
          text: viewDelegate.model.display + (flag ? "extra text" : "")
          elide: Text.ElideRight
      } 

      when tapping on the text, "extra text" will be added and "implicitWidthChanged" will be emitted. However the TreeView needs extra signals to resize, for example toggleExpanded

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            _zijinshanren_ L Z R
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes