标题:关于qml的一个很奇怪的问题
作者:kingzc1982
日期:2015-02-02 16:06
内容:
下面是我用qml编写的一个简单的测试按键的程序,在x86上,用qtcreator 仿真跑的时候一切正常,但是当我交叉编译移植到板子上跑的时候,text死活不响应按键事件 !但是如果我加上 TextEdit 控件后,就可以了。 百思不得其解啊! 拜求高手解答,多谢!
import QtQuick 1.1
Rectangle {
width: 320;
height: 480;
color: "gray";
focus: true;
Keys.enabled: true;
Keys.onEscapePressed: {
Qt.quit();
}
Keys.onDigit0Pressed : {
Qt.quit();
}
Keys.forwardTo: ;
/*
TextEdit{
id:edit
width:200
height: 50
x:50
y:50
color: "blue"
focus: true
}
*/
Text {
id: moveText;
x: 20;
y: 20;
width: 200;
height: 30;
text: "Moving Text";
color: "blue";
// focus: true;
font { bold: true; pixelSize: 24;}
Keys.enabled: true;
Keys.onP ..
#1 [执笔画江山 02-03 09:58]
因为你的按键响应需要加到文本编辑框中,不然你的按键内容输入到哪里去?
#2 [kingzc1982 02-03 17:39]
正常是没问题的,只是我的底层除了问题,现在已经解决了。