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

Wrong return value from 'property var' functions

    XMLWordPrintable

Details

    • Ia4b99d3c58c4482e9505cf2461bd14942a9a00ca

    Description

      The return value from a function assigned to a property var (only declarative style) is always undefined. See the code snippet below

      import QtQuick 2.0
      
      Rectangle {
          width: 360
          height: 360
      
          property var f1 : function () {
              console.log("Test case 1");
              return 100;
          }
          property var f2;
          function testcase2() {
              console.log("Test case 2");
              return 200;
          }
          Component.onCompleted: {
              f2 = testcase2;
              console.log('f1 :'+f1);
              console.log('f2 :'+f2);
          }
      }
      

      Attachments

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

        Activity

          People

            raggi Roberto Raggi
            pullatti Prasanth Ullattil
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes