You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
QT's official [http://doc.qt.io/qt-5/qml-codingconventions.html](QML Coding Standards guide) and QML documentation isn't always consistent with respect to end-of-line semicolon usage. When writing QML code for High Fidelity, follow these rules with respect to semicolons:
1055
+
1056
+
#### Multi-Line Property Expressions
1057
+
1058
+
*DO* use semicolons at the end of lines when defining multi-line property expressions:
1059
+
1060
+
```
1061
+
height: {
1062
+
if (parent.height > 100) {
1063
+
return parent.height;
1064
+
} else {
1065
+
return parent.height / 2;
1066
+
}
1067
+
}
1068
+
```
1069
+
1070
+
#### Signal Handlers
1071
+
1072
+
*DO* use semicolons at the end of lines when defining signal handlers:
1073
+
1074
+
```
1075
+
onRepositionLockedChanged: {
1076
+
if (!repositionLocked) {
1077
+
d.handleSizeChanged();
1078
+
}
1079
+
}
1080
+
```
1081
+
1082
+
#### JavaScript Functions within QML
1083
+
1084
+
*DO* use semicolons at the end of lines when defining JavaScript functions and signals from within QML:
1085
+
1086
+
```
1087
+
function fromScript(message) {
1088
+
console.log("Hello world!");
1089
+
console.log(JSON.stringify(message));
1090
+
}
1091
+
```
1092
+
1093
+
```
1094
+
signal sendToScript(var message);
1095
+
```
1096
+
1097
+
#### All Other Cases
1098
+
1099
+
*DO NOT* use semicolons at the end of lines in all other cases:
0 commit comments