PyQt/partner_625781186/QML_QtQuick_PY/python_QML调用基础/3-QML连接信号到Python/test3.qml
2018-04-16 23:17:02 +08:00

22 lines
No EOL
470 B
QML

import QtQuick 2.0
Rectangle {
id: root
width: 320; height: 240
color: "lightgray"
signal sendClicked(string str) // 定义信号
Text {
id: txt
text: "Clicked me"
font.pixelSize: 20
anchors.centerIn: parent
}
MouseArea {
id: mouse_area
anchors.fill: parent //有效区域
onClicked: {
root.sendClicked("Hello, Python3")//发射信号到Python
}
}
}