diff options
author | Jasper Ras <jaspert.ras@gmail.com> | 2025-07-17 21:35:57 +0200 |
---|---|---|
committer | Jasper Ras <jaspert.ras@gmail.com> | 2025-07-17 21:35:57 +0200 |
commit | 1dbacfecb241f5eb6b512f78b0b243615b971c1a (patch) | |
tree | 11eccd950d9db01c5d98d30183a911623d388b42 /Quickshell.md | |
parent | a3bfa174cdf22bf9366bb511ffb7d461d49b3cf7 (diff) |
read more about QML language
Diffstat (limited to 'Quickshell.md')
-rw-r--r-- | Quickshell.md | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/Quickshell.md b/Quickshell.md index a0401f4..607441f 100644 --- a/Quickshell.md +++ b/Quickshell.md @@ -30,6 +30,29 @@ A reusable tree of objects. To prevent many of the same processes when we reuse a component many times use `Scope` to move them outside of the reused component. We can use a [Property Definition](https://quickshell.org/docs/configuration/qml-overview/#property-definitions) on the parent scope to communicate between components in different scopes but in the same parent scope. Properties are reactive. +# Objects +Properties + +`[required] [readonly] [default] property <type> <name>[: binding]` + +`id` is a special property that can be used to reference an object throughout +the entire current file. Has to be lowercase. + + +Functions + +``` +function <name>(<paramname>[: <type>][, ...])[: returntype] { + // multiline expression (note that `return` is required) +} +``` + +Can be invoked in expressions, reactivity is carried through -- so +if the argument value changes all expressions are re-evaluated. + +Lambas `() => ...` + + # Multiple files shell.qml is the root. If a filename starts with a capital letter it can be referenced. E.g Bar.qml ``` @@ -46,4 +69,28 @@ Has only one instance that is accessible from every scope. For example the date Set `pragma Singleton` at the top of the file ( before imports ). and Use `Singleton` type. -[Clock formatting](https://doc.qt.io/qt-6/qml-qtqml-qt.html#formatDateTime-method)
\ No newline at end of file +[Clock formatting](https://doc.qt.io/qt-6/qml-qtqml-qt.html#formatDateTime-method) + + +# Signals +Event emitter. +Same rules as properties and function. + +`signal <name>(<paramname>: <type>[, ...])` + +Objects have implict `on<Signal>` (note capital S) for each signal defined. + +Connections object can be used to access difficult to reach signal handlers, +such as those from Singletons. + +`Connections { target: id; function onClicked() # example target: button }` +Does that somehow override the onClicked function of the target?? + + +All properties have `propertynameChanged` handler, powering the reactivity. + + +# Attached objects +Every object has `Component` attached, used to run stuff when an Object finishes +initializes using `Component.onCompleted`. + |