bool UIActionPool::processHotKey(const QKeySequence &key) { /* Get the list of keys: */ QList<int> keys = m_pool.keys(); /* Iterate through the whole list of keys: */ for (int i = 0; i < keys.size(); ++i) { /* Get current action: */ UIAction *pAction = m_pool[keys[i]]; /* Skip menus/separators: */ if (pAction->type() == UIActionType_Menu) continue; /* Get the hot key of the current action: */ QString strHotKey = VBoxGlobal::extractKeyFromActionText(pAction->text()); if (pAction->isEnabled() && pAction->isVisible() && !strHotKey.isEmpty()) { if (key.matches(QKeySequence(strHotKey)) == QKeySequence::ExactMatch) { /* We asynchronously post a special event instead of calling * pAction->trigger() directly, to let key presses and * releases be processed correctly by Qt first. * Note: we assume that nobody will delete the menu item * corresponding to the key sequence, so that the pointer to * menu data posted along with the event will remain valid in * the event handler, at least until the main window is closed. */ QApplication::postEvent(this, new ActivateActionEvent(pAction)); return true; } } } return false; }