UniversalEntry: fix input method issue on macOS

This commit is contained in:
Le Tan 2018-05-29 19:52:54 +08:00
parent c302cd3bfc
commit b63e5def85
2 changed files with 13 additions and 0 deletions

View File

@ -3093,9 +3093,18 @@ void VMainWindow::initUniversalEntry()
{ {
m_ue = new VUniversalEntry(this); m_ue = new VUniversalEntry(this);
m_ue->hide(); m_ue->hide();
#if defined(Q_OS_MACOS) || defined(Q_OS_MAC)
// Qt::Popup on macOS does not work well with input method.
m_ue->setWindowFlags(Qt::Tool
| Qt::NoDropShadowWindowHint);
m_ue->setWindowModality(Qt::ApplicationModal);
#else
m_ue->setWindowFlags(Qt::Popup m_ue->setWindowFlags(Qt::Popup
| Qt::FramelessWindowHint | Qt::FramelessWindowHint
| Qt::NoDropShadowWindowHint); | Qt::NoDropShadowWindowHint);
#endif
connect(m_ue, &VUniversalEntry::exited, connect(m_ue, &VUniversalEntry::exited,
this, [this]() { this, [this]() {
m_captain->setCaptainModeEnabled(true); m_captain->setCaptainModeEnabled(true);

View File

@ -274,6 +274,10 @@ void VUniversalEntry::keyPressEvent(QKeyEvent *p_event)
break; break;
case Qt::Key_Escape:
hide();
return;
// Up/Down Ctrl+K/J to navigate to next item. // Up/Down Ctrl+K/J to navigate to next item.
case Qt::Key_Up: case Qt::Key_Up:
forward = false; forward = false;