Getting Ctrl+[number] key presses on laptop keyboard
-
Hello,
I need to catch Ctrl+[number] (= Ctrl + 1, Ctrl + 2, ...) key presses. I have no problems whatsoever to catch it on classic (on numeric keyboard) keyboard with
@ QKeySequence("Ctrl+1") @
but I just cannot catch it on laptops (with only two keys pressed).
Of course it is possible to "emulate" this keypress by clicking Ctrl+Shift+1 on laptop keyboards, but I want to use it without that Shift.
The main problem is, that on each locale, it is emiting different signals. For example, Ctrl + 2 will be Ctrl + ě on czech layout.
Is there any way to do it?I hope you understand me, and thanks for any answer!
-
Have you tried <code>QKeySequence(Qt::CTRL + Qt::Key_1)</code> or overriding one of the key events, for example QWidget::keyReleaseEvent()? <code>QKeySequence(const QString &)</code> is always subject to locales (use <code>QKeySequence(tr("Ctrl+1"))</code> instead).
-
QKeySequence(Qt::CTRL + Qt::Key_1) is working only by pressing Ctrl+Shift+1
Overriding key events has the same behaviour. -
Why do you have to press shift again?
(On laptops I'm used to know the numeric keyboard is disabled until NumLock is selected. Once selected, the numeric keyboard behaves like an oridnary numeric keyboard).