Define keyboard codes for Cyrillic letters, enable shortcuts using them

This commit is contained in:
Yuriy Skalko 2020-09-15 20:21:54 +03:00
parent 1dd9c490a1
commit a0b65e9bf8

View File

@ -354,6 +354,80 @@ static int string_to_qkey(std::string const & str)
if (str == "Help") return Qt::Key_Help;
if (str == "BackTab") return Qt::Key_Backtab;
// Keyboard codes for Cyrillic letters
if (str == "А") return 1040;
if (str == "Б") return 1041;
if (str == "В") return 1042;
if (str == "Г") return 1043;
if (str == "Д") return 1044;
if (str == "Е") return 1045;
if (str == "Є") return 1028;
if (str == "Ё") return 1025;
if (str == "Ж") return 1046;
if (str == "З") return 1047;
if (str == "И") return 1048;
if (str == "І") return 1030;
if (str == "Ї") return 1031;
if (str == "Й") return 1049;
if (str == "К") return 1050;
if (str == "Л") return 1051;
if (str == "М") return 1052;
if (str == "Н") return 1053;
if (str == "О") return 1054;
if (str == "П") return 1055;
if (str == "Р") return 1056;
if (str == "С") return 1057;
if (str == "Т") return 1058;
if (str == "У") return 1059;
if (str == "Ф") return 1060;
if (str == "Х") return 1061;
if (str == "Ц") return 1062;
if (str == "Ч") return 1063;
if (str == "Ш") return 1064;
if (str == "Щ") return 1065;
if (str == "Ъ") return 1066;
if (str == "Ы") return 1067;
if (str == "Ь") return 1068;
if (str == "Э") return 1069;
if (str == "Ю") return 1070;
if (str == "Я") return 1071;
if (str == "а") return 1040;
if (str == "б") return 1041;
if (str == "в") return 1042;
if (str == "г") return 1043;
if (str == "д") return 1044;
if (str == "е") return 1045;
if (str == "є") return 1028;
if (str == "ё") return 1025;
if (str == "ж") return 1046;
if (str == "з") return 1047;
if (str == "и") return 1048;
if (str == "і") return 1030;
if (str == "ї") return 1031;
if (str == "й") return 1049;
if (str == "к") return 1050;
if (str == "л") return 1051;
if (str == "м") return 1052;
if (str == "н") return 1053;
if (str == "о") return 1054;
if (str == "п") return 1055;
if (str == "р") return 1056;
if (str == "с") return 1057;
if (str == "т") return 1058;
if (str == "у") return 1059;
if (str == "ф") return 1060;
if (str == "х") return 1061;
if (str == "ц") return 1062;
if (str == "ч") return 1063;
if (str == "ш") return 1064;
if (str == "щ") return 1065;
if (str == "ъ") return 1066;
if (str == "ы") return 1067;
if (str == "ь") return 1068;
if (str == "э") return 1069;
if (str == "ю") return 1070;
if (str == "я") return 1071;
return Qt::Key_unknown;
}
@ -574,6 +648,44 @@ static std::string const qkey_to_string(int lkey)
case Qt::Key_Help: return "Help";
case Qt::Key_Backtab: return "BackTab";
// Cyrillic
case 1040: return "а";
case 1041: return "б";
case 1042: return "в";
case 1043: return "г";
case 1044: return "д";
case 1045: return "е";
case 1028: return "є";
case 1025: return "ё";
case 1046: return "ж";
case 1047: return "з";
case 1048: return "и";
case 1030: return "і";
case 1031: return "ї";
case 1049: return "й";
case 1050: return "к";
case 1051: return "л";
case 1052: return "м";
case 1053: return "н";
case 1054: return "о";
case 1055: return "п";
case 1056: return "р";
case 1057: return "с";
case 1058: return "т";
case 1059: return "у";
case 1060: return "ф";
case 1061: return "х";
case 1062: return "ц";
case 1063: return "ч";
case 1064: return "ш";
case 1065: return "щ";
case 1066: return "ъ";
case 1067: return "ы";
case 1068: return "ь";
case 1069: return "э";
case 1070: return "ю";
case 1071: return "я";
default:
case Qt::Key_unknown: return "";
}