How can I let users use control + + for zoom in and control + - for zoom out?

前端 未结 2 1467
醉梦人生
醉梦人生 2021-01-26 07:09

The problem with my code below is that on US/UK keyboard layouts + is generated with shift + =, but when the user uses both the control and shift modif

2条回答
  •  遥遥无期
    2021-01-26 07:46

    You have to use Qt.ShiftModifier for reacting on shift key:

    Item {
        focus: true
        Keys.onPressed: {
            if ((event.key == Qt.Key_Plus) && (event.modifiers & Qt.ShiftModifier))
                console.log("PRessed");
        }
    }
    

提交回复
热议问题