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

currentItem of QML view returns null when casted as a component imported with folder import

    XMLWordPrintable

Details

    Description

      See the attached example to reproduce the issue. 

      MyGrid.qml has the following readonly properties:

      readonly property MyDelegate castedCurrentItem: (grid.currentItem as MyDelegate)
      readonly property var currentItem: grid.currentItem

      The first returns null in the test case tst_Grid:

      tryVerify(function () {
                  return myGrid.castedCurrentItem !== null
                  //return myGrid.currentItem !== null //this works fine
              })

      qml_unittest_cast_bug.zip

      Attachments

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

        Activity

          People

            hatemelkharashy Hatem ElKharashy
            pijaouen Pierre Jaouen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes