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

前端 未结 2 1468
醉梦人生
醉梦人生 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条回答
  •  旧时难觅i
    2021-01-26 07:56

    Instead of Key.onPressed use Shortcut and its sequence property :

    Shortcut {
        sequence: StandardKey.ZoomIn
        onActivated: zoom(true)
    }
    

    Your issue is mentionned in this section of the QKeySequence documentation.

提交回复
热议问题