Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

property { } syntax #250

Open
Benn20002 opened this issue Dec 26, 2024 · 0 comments
Open

property { } syntax #250

Benn20002 opened this issue Dec 26, 2024 · 0 comments

Comments

@Benn20002
Copy link

I have several issues/questions regarding the usage of {/} in properties.
In QML by Qt I often use something like this (in a more complex way) to assign values to properties:

property int test: {
   if (a) {
      return 1;
   } else {
      return 2;
   }
}

I know this particular case is possible with something like this

property int test: a ? 1 : 2

but for more complex cases the first option is needed.

My second issue is when trying to declare a js-object like this:

property var test: {
   "a": "b"
}

it is not giving an error but when having more then one entry

property var test: {
   "a": "b",
   "c": "d"
}

I get this error:
"a": "b",
^-- Expected string or identifier as object key

Am I doing anything wrong or are both cases not really implemented yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant