Window::Window() { // Init lineEdit lineEdit = new QLineEdit; lineEdit->setFixedWidth(300); lineEdit->setFocus(); connect(lineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(onTextChanged())); connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(onEscape())); // Add lineEdit to a layout QBoxLayout *layout = new QBoxLayout(QBoxLayout::LeftToRight); layout->addWidget(lineEdit); setLayout(layout); // Init shortcut processer shortcut = new QShortcut(QKeySequence(Qt::Key_Escape), this); shortcut->setContext(Qt::ApplicationShortcut); connect(shortcut, SIGNAL(activated()), this, SLOT(onEscape())); // Set title of the window setWindowTitle(tr("Vietnamese Input Panel")); // Init key processor keyProcessor = new KeyProcessor; }
void ChatUserInterface::onLobbyChat() { // Escape chat only if the previous UI isn't UIQueryServers // This is to prevent spamming the chat window with joined/left messages if(getUIManager()->getPrevUI() == getUIManager()->getUI<QueryServersUserInterface>()) getUIManager()->reactivatePrevUI(); else onEscape(); }
void MenuUserInterface::onKeyDown(U32 key) { if(key == '\r') { UserInterface::playBoop(); processSelection(menuItems[selectionIndex].mIndex); } else if(key == 27) { UserInterface::playBoop(); onEscape(); } }
void MenuUserInterface::onControllerButtonDown(U32 buttonIndex) { if(buttonIndex == 0) { UserInterface::playBoop(); processSelection(menuItems[selectionIndex].mIndex); } else if(buttonIndex == 1) { UserInterface::playBoop(); onEscape(); } }
bool ChatUserInterface::onKeyDown(InputCode inputCode) { if(Parent::onKeyDown(inputCode)) { /* Do nothing */ } else if(inputCode == KEY_ESCAPE || checkInputCode(BINDING_LOBBYCHAT, inputCode)) onEscape(); else if (inputCode == KEY_ENTER) // Submits message issueChat(); else return mLineEditor.handleKey(inputCode); // A key was handled return true; }