From 4cc91a6a0e4f9063233a4d6554ae64855cf99c14 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 12 Feb 2021 08:53:00 +0100 Subject: Use functions as signal handlers when accessing parameters Injected signal handlers are bad practice because they aren't declared. Pick-to: 6.1 Task-number: QTBUG-89943 Change-Id: I3a691f68342a199bd63034637aa7ed438e3a037b Reviewed-by: Fabian Kosmale --- src/qml/doc/snippets/qml/events.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/qml/doc/snippets') diff --git a/src/qml/doc/snippets/qml/events.qml b/src/qml/doc/snippets/qml/events.qml index f437e32890..d29be5ebd2 100644 --- a/src/qml/doc/snippets/qml/events.qml +++ b/src/qml/doc/snippets/qml/events.qml @@ -66,7 +66,7 @@ Rectangle { //! [signal handler declaration] onTrigger: console.log("trigger signal emitted") -onSend: { +onSend: (notice)=> { console.log("send signal emitted with notice: " + notice) } @@ -90,7 +90,7 @@ Rectangle { signal send(person: string, notice: string) - onSend: { + onSend: (person, notice)=> { console.log("For " + person + ", the notice is: " + notice) } @@ -103,7 +103,7 @@ Rectangle { id: relay signal send(person: string, notice: string) - onSend: console.log("Send signal to: " + person + ", " + notice) + onSend: (person, notice)=> console.log("Send signal to: " + person + ", " + notice) Component.onCompleted: { relay.send.connect(sendToPost) -- cgit v1.2.3