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

[REG 5.x -> 5.12] Javascript function calls not using local scope

    XMLWordPrintable

    Details

    • Commits:
      aabf4e4f0474d8d6eb065fbab700432718070ae0 (qt/qtdeclarative/5.12)

      Description

      If a property in the global scope has the same name as a local function, QML trys to call property instead of the local function. This worked fine in Qt before 5.12.

      Example:

      import QtQuick 2.5
      
      Item {
          property bool testFunc
      
          Item {
              function testFunc2() {
                  console.log("testFunc2 called")
              }
      
              function testFunc() {
                  console.log("testFunc called")
              }
      
              Component.onCompleted: {
                  testFunc2()
                  testFunc()   //  works fine before Qt 5.12
              }
          }
      
      }
      
      
      // Qt 5.11.2 output:
      testFunc2 called
      testFunc called
      
      // Qt 5.12 output
      testFunc2 called 
      Test.qml:17: TypeError: Property '42' of context object is not a function

        Attachments

          Issue Links

          For Gerrit Dashboard: QTBUG-71204
          # Subject Branch Project Status CR V

            Activity

              People

              Assignee:
              shausman Simon Hausmann
              Reporter:
              zerocom Stefan Sommerfeld
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes