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

The height of the Item in the ListView is not reflected in the contentHeight when there is only one Item.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 6.5.5
    • GUI: Other
    • None
    • - Qt 6.5.5
      - Clang arm64-v8a
      - Android 11 ~ 14
    • Android

    Description

      Steps to Reproduce

      1. Have only one Item in the ListView.
      2. Launch the application.

      Hypothesis

      • I suspect that contentHeightChanged() is not emitted when there is only one Item in the ListView.

      Request

      • Ensure that contentHeightChanged() is emitted even when there is only one Item in the ListView.

      Snippet

      ListView {
          id: listView
          visible: notificationDeviceManager.deviceIdList.length !== 0
          anchors.horizontalCenter: parent.horizontalCenter
          width: useNameArea.width // Width of the sibling
          height: contentHeight
          spacing: 10
          model: notificationDeviceManager.deviceIdList
          interactive: false   
       
           property int cellHeight: bodyArea.height * 0.1 // Height of the parent    
           delegate: Item {
              width: listView.width
              height: listView.cellHeight
          }
      }
      

       

      Additional Information

      • Regarding debug.log: Information compared to Qt 5.15.15 is included.
      • I added the following log outputs for debugging purposes.
      ListView {
      ...
          onContentHeightChanged: {
              console.log("onContentHeightChanged : contentHeight : ",  contentHeight);
          }
      
          onHeightChanged: {
              console.log("onHeightChanged : height : ", height);
          }
      ...
      }

       

      Attachments

        1. compared_expected_unexpected_layouts.png
          compared_expected_unexpected_layouts.png
          791 kB
        2. debug.log
          1 kB
        3. worksforme.qml
          0.6 kB
        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
            dfree Atsushi Nakanishi
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes