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

Generator functions can't access properties

    XMLWordPrintable

    Details

      Description

      I have a generator function that's nested in a QML element like this

       

      Rectangle {
         id: fileContainer
         property real a: 0
      
         function refreshA() {
            AsyncJS.coro(function*() { a = yield getResultsAsync(); });
         }
      }
      

      AsyncJS.coro executes the generator whenever necessary when Promises resolve. But it turns out that both 'fileContainer' and 'a' is not visible within the generator. When I pass 'fileContainer' as a parameter into the generator it works, but is very cumbersome and doesn't support unqualified lookup of property and id names.

       

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              qt.team.quick.subscriptions Qt Quick and Widgets Team
              Reporter:
              jschaubzes Johannes Schaub
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes