25 -| `import QtQuick` | A Qt module. Optional major.minor version. |
26 -| `import QtQuick 6.5` | Pin a version for stability. |
27 -| `import QtQuick as Q` | Namespace prefix. Use `Q.Item`. |
28 -| `import "my.js" as MyJs` | JavaScript file as namespace. |
29 -| `import "subfolder"` | Relative-path folder import. |
30 -| `import "subfolder" as Sub` | Same, namespaced. |
24 +| --------------------------- | ------------------------------------------ |
25 +| `import QtQuick` | A Qt module. Optional major.minor version. |
26 +| `import QtQuick 6.5` | Pin a version for stability. |
27 +| `import QtQuick as Q` | Namespace prefix. Use `Q.Item`. |
28 +| `import "my.js" as MyJs` | JavaScript file as namespace. |
29 +| `import "subfolder"` | Relative-path folder import. |
30 +| `import "subfolder" as Sub` | Same, namespaced. |
32 32 **Module and namespace names** must start with an uppercase letter. `import qtquick` is an error.
56 56 The QML value types, with QML-side aliases:
58 -| Type | Example | Notes |
60 -| `int` | `0`, `-1` | |
61 -| `real` | `0.5`, `1e-3` | QML's float = double. |
62 -| `double` | (rare) | |
63 -| `string` | `"hello"` | |
64 -| `bool` | `true` | |
65 -| `color` | `"red"`, `"#ff0000"`, `Qt.rgba(1, 0, 0, 1)` | |
66 -| `url` | `"https://..."` | Resolved against the QML file's URL. |
67 -| `var` | `[1, "x"]`, `{a: 1}` | Untyped. Use sparingly. |
68 -| `date` | `new Date()` | JS Date. |
69 -| `point` | `Qt.point(0, 0)` | `{x, y}`. |
70 -| `size` | `Qt.size(100, 50)` | `{width, height}`. |
71 -| `rect` | `Qt.rect(0, 0, 100, 50)` | `{x, y, width, height}`. |
72 -| `vector2d`, `vector3d`, `vector4d` | `Qt.vector2d(0, 0)` | |
73 -| `quaternion` | `Qt.quaternion(0, 0, 0, 1)` | |
74 -| `matrix4x4` | `Qt.matrix4x4(...)` | |
75 -| `font` | `font.family: "Inter"` | Structured type. |
76 -| `enumeration` | `Text.AlignLeft` | Object's enums. |
58 +| Type | Example | Notes |
59 +| ---------------------------------- | ------------------------------------------- | ------------------------------------ |
60 +| `int` | `0`, `-1` | |
61 +| `real` | `0.5`, `1e-3` | QML's float = double. |
62 +| `double` | (rare) | |
63 +| `string` | `"hello"` | |
64 +| `bool` | `true` | |
65 +| `color` | `"red"`, `"#ff0000"`, `Qt.rgba(1, 0, 0, 1)` | |
66 +| `url` | `"https://..."` | Resolved against the QML file's URL. |
67 +| `var` | `[1, "x"]`, `{a: 1}` | Untyped. Use sparingly. |
68 +| `date` | `new Date()` | JS Date. |
69 +| `point` | `Qt.point(0, 0)` | `{x, y}`. |
70 +| `size` | `Qt.size(100, 50)` | `{width, height}`. |
71 +| `rect` | `Qt.rect(0, 0, 100, 50)` | `{x, y, width, height}`. |
72 +| `vector2d`, `vector3d`, `vector4d` | `Qt.vector2d(0, 0)` | |
73 +| `quaternion` | `Qt.quaternion(0, 0, 0, 1)` | |
74 +| `matrix4x4` | `Qt.matrix4x4(...)` | |
75 +| `font` | `font.family: "Inter"` | Structured type. |
76 +| `enumeration` | `Text.AlignLeft` | Object's enums. |
78 78 ##
Property modifiers 80 -| Modifier | Effect |
82 -| `readonly` | Can be assigned in the initial binding only. |
83 -| `default` | This is the default property — child objects go into it. |
84 -| `required` | The user must set this property. `qmllint` enforces. |
85 -| `property` (alone) | The default — a normal reactive property. |
80 +| Modifier | Effect |
81 +| ------------------ | -------------------------------------------------------- |
82 +| `readonly` | Can be assigned in the initial binding only. |
83 +| `default` | This is the default property — child objects go into it. |
84 +| `required` | The user must set this property. `qmllint` enforces. |
85 +| `property` (alone) | The default — a normal reactive property. |
112 112 onClicked: count = count + 1
115 -**Important:** assigning to a property *breaks* any active binding. After `height = 200`, the `height: parent.width / 2` binding is gone forever.
115 +**Important:** assigning to a property _breaks_ any active binding. After `height = 200`, the `height: parent.width / 2` binding is gone forever.
117 117 ## Common patterns
178 178 ##
Useful singletons 180 -| Singleton | What |
182 -| `Qt` | Format functions, point/size/rect, `Qt.callLater(fn)`, `Qt.platform`, `Qt.application`. |
183 -| `Application` | `Application.name`, `Application.version`, `Application.organization`. |
184 -| `Settings` (from `Qt.labs.settings`) | Persist properties to QSettings. |
185 -| `Workspace` (in Qt 6) | Mutex for app-wide locks. |
180 +| Singleton | What |
181 +| ------------------------------------ | --------------------------------------------------------------------------------------- |
182 +| `Qt` | Format functions, point/size/rect, `Qt.callLater(fn)`, `Qt.platform`, `Qt.application`. |
183 +| `Application` | `Application.name`, `Application.version`, `Application.organization`. |
184 +| `Settings` (from `Qt.labs.settings`) | Persist properties to QSettings. |
185 +| `Workspace` (in Qt 6) | Mutex for app-wide locks. |
187 187 For more, see the Qt documentation linked in `SKILL.md`.