Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Let's say that these QKeyEvents are respectively
- // an event triggered by a Greek keyboard pressing
- // the W key and the S key (without any modifiers)
- QKeyEvent *w, *s;
- // Then we convert the key to a QKeySequence (we said
- // here above that there were no modifiers, so we are
- // not keeping out any info in this particular case by
- // only looking at QKeyEvent::key())
- QKeySequence keyseq_w = QKeySequence(w->key());
- QKeySequence keyseq_s = QKeySequence(s->key());
- // Although two physically different keys were pressed,
- // QKeyEvent::key() returns 931 for both the W key as
- // the S key.
- //
- // This has to do with the fact that both keys are
- // holding sigma...
- // W => ς, Σ (lower-case in word-final positin, upper-case)
- // S => σ, Σ (lower-case, upper-case)
- // See wiki on Sigma: https://en.wikipedia.org/wiki/Sigma
- //
- // ... and that QKeyEvent::key() does not distinguish
- // between capital and non-capital letters.
- // See documentation: http://doc.qt.io/qt-4.8/qkeyevent.html#key
- w->key() == s->key(); // True (see comment for why this is true)
- // True because both are constructed with the same key
- // code (931) and thus are identical QKeySequences
- keyseq_w == keyseq_s;
Advertisement
Add Comment
Please, Sign In to add comment