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

[QMLTC] Using "parent" in QML causes TypeError during runtime

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • 6.10
    • 6.8.1
    • QML: Compiler
    • None

    Description

      Repo: https://git.qt.io/mikio_hirai/qmltc_parents_typeerror/-/commit/c1f3497874e4daec82cd68e668043ce1f5b5e933

       

      <Issue>
      Using parent in qml files lead to runtime errors as follows:

      qrc:/qt/qml/QmlTC_parents_cannot_be_used/Main.qml:11:9: TypeError: Cannot read property 'height' of null
      qrc:/qt/qml/QmlTC_parents_cannot_be_used/Main.qml:10:9: TypeError: Cannot read property 'width' of null
      qrc:/qt/qml/QmlTC_parents_cannot_be_used/Main.qml:17:13: TypeError: Cannot read property 'height' of null
      qrc:/qt/qml/QmlTC_parents_cannot_be_used/Main.qml:16:13: TypeError: Cannot read property 'width' of null 

      These errors don't kill the app and even with the TypeErrors, the GUI appears to be that parent is actually working fine.

      parent is frequently used in Qt Quick apps, so if these errors mean nothing, they shouldn't be output in the first place to avoid confusion. 

      In my opinion, since parent is used in most Qt Quick apps, these TypeErrors should not even be occuring and developers should be allowed to use parent in their QML files even with QMLTC.

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            mikio_hirai Mikio Hirai
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes