本代码是通过键盘按键控制两种字体的改变
Item {
id:loginView
focus: true
Keys.enabled: true
//Keys.onReturnPressed: login_btn.login()
Keys.onEscapePressed: Qt.quit()
Keys.onPressed: {
if(event.key === Qt.Key_F1)
{
if(fontStatus ==1)
{
fontName ="宋体"
fontStatus=1-fontStatus
}else
{
fontName ="微软雅黑"
fontStatus=1+fontStatus
}
}
else if(event.key === Qt.Key_Escape)
{
//windowManager.closeWindow()
}
}
}