MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / ConvertHostKeyboardStringToCode

Method ConvertHostKeyboardStringToCode

pcsx2-qt/QtKeyCodes.cpp:510–527  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

508 {Qt::Key_CameraFocus, "CameraFocus", nullptr}};
509
510std::optional<u32> InputManager::ConvertHostKeyboardStringToCode(const std::string_view str)
511{
512 std::string_view compare_name = str;
513 u32 modifier_bits = 0;
514 if (compare_name.starts_with("Numpad"))
515 {
516 compare_name = compare_name.substr(6);
517 modifier_bits |= Qt::KeypadModifier;
518 }
519
520 for (const KeyCodeName& name : s_qt_key_names)
521 {
522 if (compare_name == name.name)
523 return static_cast<u32>(name.code) | modifier_bits;
524 }
525
526 return std::nullopt;
527}
528
529std::optional<std::string> InputManager::ConvertHostKeyboardCodeToString(u32 code)
530{

Callers

nothing calls this directly

Calls 2

starts_withMethod · 0.80
substrMethod · 0.80

Tested by

no test coverage detected