求解! qml的 Component.onCompleted和 Keys问题
mmic 2017-09-17 09:13:02 import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
Window {
id:win;
visible: true
width: 640
height: 480
color: "black";
Text {
id: txt;
color: "white";
text: qsTr("My Test Text.");
font{
pointSize: 20;
bold: true;
italic: true;
}
Keys.enabled: false;
Keys.onEscapePressed: console.log("tab... ...");
}
Button{
id: btn;
anchors.top: txt.bottom;
anchors.topMargin: 10;
text: "TestButton";
// Component.onCompleted: {
// btn.clicked.connect(txtQuit());
// }
}
Component.onCompleted: {
btn.clicked.connect(txtQuit());
}
function txtQuit(){
Qt.quit();
}
}
Component.onCompleted: 附加组件里的信号,没有起作用不知道为什么, 麻烦那个前辈解答一下,谢谢
Key 属性也没有起作用,也不起作用,也求解下, 谢谢
Qt 版本 5.8 windows平台 Qt+vs2015编译器