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

View doesn't show items added in onCompleted unless an animation is running in the background

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • None
    • 5.0.0
    • None
    • Mac OS 10.6, 10.7

    Description

      In the example below, 10 items are added to the ListModel in Component.onCompleted, but do not appear in the view. It seems ListView calls polish() before the canvas is initialized and the view isn't rendered again once the canvas is set up.

      These items will only show up if an animation is running in the background (e.g. if you uncomment the code with the blue animated Rectangle).

      (The bug seems specific to Mac OS X.)

      import QtQuick 2.0
      
      ListView {
          width: 240; height: 320
      
          model: ListModel {
              Component.onCompleted: {
                  for (var i=0; i<10; i++) {
                      append({'name': 'item ' + i})
                  }
              }
          }
          delegate: Rectangle {
              width: 240; height: 30; border.width: 1
          }
      
          /*
          Rectangle {
              anchors.bottom: parent.bottom
              width: 20; height: 20
              color: "blue"
              NumberAnimation on x { loops: Animation.Infinite; from: 0; to: 300; duration: 100000 }
          }
          */
      }
      

      This seems to be a regression from within the last few weeks, perhaps caused by the render thread changes in qtdeclarative 926ddffa547a9f37a67554cce810045c074172b7. (Previously there was a similar bug that was fixed by b016460dc49c0ea5a1ed54c71f47ba52819921a8 and the fix seems to be missing in the new render thread implementation; although, re-applying that change to the current master doesn't fix the issue, so perhaps it's a different bug.)

      Attachments

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

        Activity

          People

            aakenned Aaron Kennedy
            bealam Bea Lam (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes