diff --git a/Qt/QtMain.cpp b/Qt/QtMain.cpp index f7937d8547..178f3f82c4 100644 --- a/Qt/QtMain.cpp +++ b/Qt/QtMain.cpp @@ -357,12 +357,16 @@ bool MainUI::event(QEvent *e) case QEvent::KeyPress: { auto qtKeycode = ((QKeyEvent*)e)->key(); - int nativeKeycode = KeyMapRawQttoNative.find(qtKeycode)->second; - NativeKey(KeyInput(DEVICE_ID_KEYBOARD, nativeKeycode, KEY_DOWN)); + auto iter = KeyMapRawQttoNative.find(qtKeycode); + int nativeKeycode = 0; + if (iter != KeyMapRawQttoNative.end()) { + nativeKeycode = iter->second; + NativeKey(KeyInput(DEVICE_ID_KEYBOARD, nativeKeycode, KEY_DOWN)); + } + // Also get the unicode value. QString text = ((QKeyEvent*)e)->text(); std::string str = text.toStdString(); - // Now, we don't want CHAR events for non-printable characters. Not quite sure how we'll best // do that, but here's one attempt.... switch (nativeKeycode) { diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 6f4c284f94..0f34bdc50c 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -803,8 +803,6 @@ void GameSettingsScreen::CreateViews() { // so until then, this is Windows/Desktop only. #if !defined(MOBILE_DEVICE) // TODO: Add all platforms where KEY_CHAR support is added systemSettings->Add(new PopupTextInputChoice(&g_Config.sNickName, sy->T("Change Nickname"), "", 32, screenManager())); -// #elif defined(USING_QT_UI) -// systemSettings->Add(new Choice(sy->T("Change Nickname")))->OnClick.Handle(this, &GameSettingsScreen::OnChangeNickname); #elif defined(__ANDROID__) systemSettings->Add(new ChoiceWithValueDisplay(&g_Config.sNickName, sy->T("Change Nickname"), (const char *)nullptr))->OnClick.Handle(this, &GameSettingsScreen::OnChangeNickname); #endif