516
516
// contains modifiers
517
517
if ( keys.mid( i ).indexOf( '-' ) != -1 && keys.mid( i ).indexOf( '-' ) < keys.mid( i ).indexOf( '>' ) ) {
518
QStringList tokens = keys.mid( i, keys.mid( i ).indexOf( '>' ) ).toLower().split( '-' );
518
// Perform something similar to a split on '-', except that we want to keep the occurrences of '-'
519
// e.g. <c-s-a> will equate to the list of tokens "c-", "s-", "a".
520
// A straight split on '-' would give us "c", "s", "a", in which case we lose the piece of information that
521
// 'a' is just the 'a' key, not the 'alt' modifier.
522
const QString untilClosing = keys.mid( i, keys.mid( i ).indexOf( '>' ) ).toLower();
526
while ((nextHypen = untilClosing.indexOf(QChar('-'), currentPos)) != -1)
528
tokens << untilClosing.mid(currentPos, nextHypen - currentPos + 1);
529
currentPos = nextHypen + 1;
531
tokens << untilClosing.mid(currentPos);
520
533
foreach ( const QString& str, tokens ) {
521
if ( str == "s" && ( keyCodeTemp & 0x01 ) != 0x1 )
534
if ( str == "s-" && ( keyCodeTemp & 0x01 ) != 0x1 )
522
535
keyCodeTemp += 0x1;
523
else if ( str == "c" && ( keyCodeTemp & 0x02 ) != 0x2 )
536
else if ( str == "c-" && ( keyCodeTemp & 0x02 ) != 0x2 )
524
537
keyCodeTemp += 0x2;
525
else if ( str == "a" && ( keyCodeTemp & 0x04 ) != 0x4 )
538
else if ( str == "a-" && ( keyCodeTemp & 0x04 ) != 0x4 )
526
539
keyCodeTemp += 0x4;
527
else if ( str == "m" && ( keyCodeTemp & 0x08 ) != 0x8 )
540
else if ( str == "m-" && ( keyCodeTemp & 0x08 ) != 0x8 )
528
541
keyCodeTemp += 0x8;
530
543
if ( m_nameToKeyCode->contains( str ) || ( str.length() == 1 && str.at( 0 ).isLetterOrNumber() ) ) {
769
782
//note that non-latin letter in Latin layout can be a punctuation character (also some punctuation differs too)
770
783
QChar tempChar(text.at(0));
771
784
//don't touch latin keys
785
if (mods == Qt::KeypadModifier && keyCode >= Qt::Key_0 && keyCode <= Qt::Key_9)
787
// Keypad numbers to ordinary numbers.
772
790
if ((keyCode < Qt::Key_A || keyCode > Qt::Key_Z) && tempChar.isLetter()) {
773
791
char ch = scanCodeToChar(nativeScanCode, mods, tempChar.isLetter());