Hi all, I was playing around with attached signals to learn how they tick. Here are two test programs, each with 3 different ways of connecting to a signal:
//========== import QtQuick 2.2 Rectangle { width: 360 height: 360 Text { text: "Click Me" anchors.centerIn: parent MouseArea { id: mouseArea anchors.fill: parent onClicked: console.log("Clicked (Direct signal handler)") } } Connections { target: mouseArea onClicked: console.log("Clicked (Connections)") } function jsFunction() { console.log("Clicked (JS Function)") } Component.onCompleted: mouseArea.clicked.connect(jsFunction) } //========== //========== import QtQuick 2.2 Rectangle { width: 360 height: 360 Rectangle { id: box width: 50 height: 50 color: "green" Drag.active: mouseArea.drag.active Drag.dragType: Drag.Automatic Drag.onDragStarted: console.log("Started (Attached Signal Handler)") MouseArea { id: mouseArea anchors.fill: parent drag.target: parent } } Connections { target: box Drag.onDragStarted: console.log("Started (Connections)") } function jsFunction() { console.log("Started (JS Function)") } Component.onCompleted: box.Drag.dragStarted.connect(jsFunction) } //========== When run them and click/drag the relevant items, the output I get is: Clicked (Direct signal handler) Clicked (Connections) Clicked (JS Function) Started (Attached Signal Handler) Started (JS Function) It looks like the Connections item doesn't activate in the dragging test. Could someone explain why that's the case? Thanks! Sze-Howe _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest