Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.2
-
None
Description
On macOS, if you use QKeyPressEvent, you will get "Num↑" etc. if you press an arrow key, using:
QString keyName = QKeySequence(keyEvent->key() | keyEvent->modifiers()).toString(QKeySequence::NativeText);
qDebug() << keyName; // Prints "Num↑", "Num↓", "Num←", "Num→" for the arrow keys
But if you reverse this and try to get QKeySequence using the string, you'll always get Qt::Key_unknown for all 4 arrow keys ("Num↑", "Num↓", "Num←", "Num→").
const QKeySequence seq(keyName); if (seq.count() >= 1) qDebug() << seq[0]; // prints 3355443 which is Qt::Key_unknown, for "Num↑", "Num↓", "Num←", "Num→"
I would expect different numbers for the 4 keyNames.
The keyEvent::key() for the arrow keys returns Qt::Key_Left, Qt::Key_Right, Qt::Key_Up and Qt::Key_Down.
Since we are using non-commercial versions of Qt, please let me know if this was fixed in Qt 6.
Attachments
Issue Links
- relates to
-
QTBUG-101160 Keyboard shortcuts don't work with non English layouts
- Reported