1. Handler
qml내에서 property 설정 시, on을 붙이게 되면 Handler로 동작 가능하다.

[code language=”cpp”] import QtQuick 2.0

Rectangle {
width: 600
height: 600

property int type : 1


onTypeChanged: {
console.log("==[JOO]== type :: " + type)
}[/code]

2. Custom QML Type에서 Signal 추가

[code language=”cpp”] // SquareButton.qml
Rectangle {
id: root

signal activated(real xPosition, real yPosition)

width: 100; height: 100

MouseArea {
anchors.fill: parent
onPressed: root.activated(mouse.x, mouse.y)
}
}[/code] 여기서 MouseArea에는 영역(경계 포함) 내의 마우스 이동을 감지하는 Signal Handler 존재한다.
(onEntered, onExited, onClicked etc,…)

[code language=”cpp”] // myapplication.qml
SquareButton {
onActivated: console.log("Activated at " + xPosition + "," + yPosition)
}[/code]

3. Qml<->qml

[code language=”cpp”] Rectangle {
id: relay

signal send( string person, string notice)
onSend: console.log("Send signal to: " + person + ", " + notice)

Component.onCompleted: {
relay.send.connect(sendToPost)
relay.send.connect(sendToTelegraph)
relay.send.connect(sendToEmail)
relay.send("Tom", "Happy Birthday")
}

function sendToPost(person, notice) {
console.log("Sending to post: " + person + ", " + notice)
}
function sendToTelegraph(person, notice) {
console.log("Sending to telegraph: " + person + ", " + notice)
}
function sendToEmail(person, notice) {
console.log("Sending to email: " + person + ", " + notice)
}
}[/code]

C++에서 QML 처리방법     |   Qml과 C++의 Connect 처리 》