Uploaded image for project: 'Qt for MCUs'
  1. Qt for MCUs
  2. QTMCU-203

Broken C++ code generated when having functions in custom module and calling them from Main.qml

    XMLWordPrintable

Details

    Description

      When there is a custom QML module which has functions and if those functions are called from the "main.qml" it ends up generating broken C++ code.

      with build errors like:
      <Path_to_Build_dir>build-qtmcu203-Qt_for_MCUs_2_5_Desktop_32bpp_MSVC-Debug\qmlproject\CMakeFiles\qtmcu203.dir\qtmcu203.cpp(64): error C2228: left of '.getLine' must have class/struct/union
      <path_to_Build_dir>\build-qtmcu203-Qt_for_MCUs_2_5_Desktop_32bpp_MSVC-Debug\qmlproject\CMakeFiles\qtmcu203.dir\qtmcu203.cpp(64): note: type is 'CustomModule::CustomButton *'
      <path_to_Build_dir>\build-qtmcu203-Qt_for_MCUs_2_5_Desktop_32bpp_MSVC-Debug\qmlproject\CMakeFiles\qtmcu203.dir\qtmcu203.cpp(64): note: did you intend to use '->' instead?

      For example:
      "printLines" is a function in "main.qml" and "printing" and "getLine" are functions in the custom module's custom QML Type (CustomButton in the attached example)

      CustomButton.qml
      ****************
      function printing(line : string)

      {...}
      function getLine(number : int) : string {...}

      ****************

      Main.qml
      ****************
      function printLines(source: CustomButton, target:CustomButton)

      { for(var i = 0; i < 10 ; ++i) target.printing(source.getLine(i)); }

      ****************

      When manually editing the generated C++ file to use '->' like suggested. It starts to work like intended.

      Way to reproduce:
      1) Try to build attached code with Qt for MCUs 2.5.
      2) It fails with the aforementioned error.
      3) Manually edit it to use '->' and compilation finishes correctly and app run without errors

      Attachments

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

        Activity

          People

            kwkim Kwangsub Kim
            foxxx Tuukka Kettunen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes