From 4bb71e57bd3973c49da92d8ea614dbe1793ffab4 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sun, 23 Jun 2024 02:44:12 -0700 Subject: [PATCH] overview: mention Connections --- content/docs/configuration/qml-overview.md | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/content/docs/configuration/qml-overview.md b/content/docs/configuration/qml-overview.md index 15e887b..560c244 100644 --- a/content/docs/configuration/qml-overview.md +++ b/content/docs/configuration/qml-overview.md @@ -536,6 +536,29 @@ ColumnLayout { } ``` +##### Indirect signal handlers +When it is not possible or not convenient to directly define a signal handler, before resorting +to `.connect`ing the properties, a [Connections] object can be used to access them. + +This is especially useful to connect to signals of singletons. + +```qml +Item { + Button { + id: myButton + text "click me" + } + + Connections { + target: myButton + + function onClicked() { + // ... + } + } +} +``` + ##### Property change signals Every property has an associated signal, which powers QML's [reactive bindings](#reactive-bindings). The signal is named `Changed` and works exactly the same as any other signal.