Address feedback

This commit is contained in:
Henrik Rydgård 2019-01-07 00:28:57 +01:00
parent 5a1fa60087
commit 5362e675c4
2 changed files with 7 additions and 5 deletions

View File

@ -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) {

View File

@ -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