How can I capture QKeySequence from QKeyEvent depending on current keyboard layout?

后端 未结 7 1521
一向
一向 2020-12-09 12:05

I need to do this for configuring my application. I have QLineEdit field with reimplemented keyPressEvent method.

QKeyEvent *ke = ...
QString txt;

if(ke->         


        
7条回答
  •  心在旅途
    2020-12-09 12:27

    Prefer a standard seqence.

    From the Keyboard Layout Issues:

    As a result, both human-readable strings and hard-coded key codes can both be problematic to use when specifying a key sequence that can be used on a variety of different keyboard layouts. Only the use of standard shortcuts guarantees that the user will be able to use the shortcuts that the developer intended.

提交回复
热议问题