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

Missing QML qualifier generates broken C++ code

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P1: Critical
    • 6.3.0
    • 6.3.0 Beta2
    • QML: Compiler
    • All

    Description

      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Item {
              id: control
      
              property var formatFunction: formatValue // control.formatValue works
      
              function formatValue(val: double) : double {
                  return Number(val).toFixed(1)
              }
          }
      }
      

      The above code compiles to

      /home/cajus/tmp/build-broken-generator-Desktop_Qt_6_3_0_GCC_64bit-Debug/.rcc/qmlcache/app_main_qml.cpp: In lambda function:
      /home/cajus/tmp/build-broken-generator-Desktop_Qt_6_3_0_GCC_64bit-Debug/.rcc/qmlcache/app_main_qml.cpp:231:18: error: use of deleted function ‘QJSValue::QJSValue(void*)’
        231 | r2 = aotContext->qmlScopeObject;
            |                  ^~~~~~~~~~~~~~
      In file included from /home/cajus/Qt/6.3.0/gcc_64/include/QtQml/qqmlprivate.h:58,
                       from /home/cajus/tmp/build-broken-generator-Desktop_Qt_6_3_0_GCC_64bit-Debug/.rcc/qmlcache/app_main_qml.cpp:2:
      /home/cajus/Qt/6.3.0/gcc_64/include/QtQml/qjsvalue.h:172:5: note: declared here
        172 |     QJSValue(void *) = delete;
            |     ^~~~~~~~
      ninja: build stopped: subcommand failed.

      which makes it hard to find the formatValue  vs control.formatValue issue in bigger files.

      Attachments

        Issue Links

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

          Activity

            People

              ulherman Ulf Hermann
              cajus Cajus Pollmeier
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes