| 1 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
| 2 | // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 |
| 3 | |
| 4 | export SuperSimple := Rectangle { |
| 5 | TouchArea { |
| 6 | clicked => { root.x += 1phx; } |
| 7 | } |
| 8 | TouchArea { |
| 9 | clicked => { x += 1phx; } |
| 10 | } |
| 11 | TouchArea { |
| 12 | clicked => { 12 += 1; } |
| 13 | // ^error{Self assignment needs to be done on a property} |
| 14 | } |
| 15 | TouchArea { |
| 16 | clicked => { x += "string" ; } |
| 17 | // ^error{Cannot convert string to length} |
| 18 | } |
| 19 | |
| 20 | TouchArea { |
| 21 | clicked => { doesnotexist += 24; } |
| 22 | // ^error{Unknown unqualified identifier 'doesnotexist'} |
| 23 | } |
| 24 | |
| 25 | TouchArea { |
| 26 | property <string> text; |
| 27 | clicked => { text *= 2; } |
| 28 | // ^error{the \*= operation cannot be done on a string} |
| 29 | } |
| 30 | |
| 31 | TouchArea { |
| 32 | property <string> text; |
| 33 | clicked => { text += 2; } |
| 34 | } |
| 35 | |
| 36 | TouchArea { |
| 37 | property <string> text; |
| 38 | clicked => { |
| 39 | text /= "hello" ; |
| 40 | // ^error{the /= operation cannot be done on a string} |
| 41 | text *= 2; |
| 42 | // ^error{the \*= operation cannot be done on a string} |
| 43 | text -= text; |
| 44 | // ^error{the -= operation cannot be done on a string} |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | TouchArea { |
| 49 | property <brush> color; |
| 50 | clicked => { color += color; } |
| 51 | // ^error{the \+= operation cannot be done on a brush} |
| 52 | } |
| 53 | |
| 54 | TouchArea { |
| 55 | property <brush> color; |
| 56 | clicked => { color *= 3; } |
| 57 | // ^error{the \*= operation cannot be done on a brush} |
| 58 | } |
| 59 | |
| 60 | TouchArea { |
| 61 | clicked => { height /= height; } |
| 62 | // ^error{Cannot convert length to float} |
| 63 | } |
| 64 | |
| 65 | } |
| 66 | |