PyQt/partner_625781186/QML_QtQuick_PY/python_QML调用基础/1-QML显式的调用Python函数,无返回值/test.qml

19 lines
408 B
QML
Raw Normal View History

2018-04-16 23:17:02 +08:00
import QtQuick 2.0
Rectangle {
width: 320; height: 240
color: "lightblue"
Text {
id: txt
text: "Clicked me"
font.pixelSize: 20
anchors.centerIn: parent
}
MouseArea {
id: mouse_area
anchors.fill: parent // 有效区域
onClicked: {
con.outputString("Hello, Python3") //QML显式的调用Python函数
}
}
}