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

"TypeError: Cannot read property of null" error in "QML Dynamic View Ordering Tutorial 1" example

    XMLWordPrintable

Details

    • 1b165a141a (qt/tqtc-qtdeclarative/5.15) 8ff399b594 (qt/tqtc-qtdeclarative/6.2) 7af1f664ac (qt/qtdeclarative/dev) 7af1f664ac (qt/tqtc-qtdeclarative/dev) d04c122a52 (qt/qtdeclarative/6.4) d04c122a52 (qt/tqtc-qtdeclarative/6.4)

    Description

      "QML Dynamic View Ordering Tutorial 1"
      https://doc.qt.io/qt-6/qtquick-tutorials-dynamicview-dynamicview1-example.html
      <Qt_installation_folder>\Examples\<Qt_vers>\quick\tutorials\dynamicview\dynamicview1

      Outputs the following error when the View is scrolled:
      qrc:/dynamicview/dynamicview.qml:66: TypeError: Cannot read property 'left' of null
      qrc:/dynamicview/dynamicview.qml:66: TypeError: Cannot read property 'right' of null

      Way to reproduce:
      1) Build and run the "QML Dynamic View Ordering Tutorial 1" example
      2) scroll the view. Find the errors in the "Application Output"

      Using:
      Component.onCompleted:

      {anchors.left = parent.left; anchors.right = parent.right}

      Instead of:
      anchors

      { left: parent.left; right: parent.right }

      //on line 66

      , seems to fix this. As far as I understand, it seems to try to read the properties before the component is completed.

      It doesn't output the warning in Qt 5.12.12

      Attachments

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

        Activity

          People

            oulu_hillbilly Sami Varanka
            foxxx Tuukka Kettunen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes