本文整理汇总了C++中MythUIType::keyPressEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ MythUIType::keyPressEvent方法的具体用法?C++ MythUIType::keyPressEvent怎么用?C++ MythUIType::keyPressEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MythUIType
的用法示例。
在下文中一共展示了MythUIType::keyPressEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keyPressEvent
/** \brief keyboard/LIRC event handler.
*
* This translates key presses through the "Main Menu" context into MythTV
* actions and then handles them as appropriate.
*/
bool MythThemedMenu::keyPressEvent(QKeyEvent *event)
{
if (m_ignorekeys)
return false;
m_ignorekeys = true;
MythUIType *type = GetFocusWidget();
if (type && type->keyPressEvent(event))
{
m_ignorekeys = false;
return true;
}
QStringList actions;
bool handled = false;
handled = GetMythMainWindow()->TranslateKeyPress("Main Menu", event,
actions);
for (int i = 0; i < actions.size() && !handled; i++)
{
QString action = actions[i];
handled = true;
if (action == "ESCAPE" || action == "EXIT" || action == "EXITPROMPT")
{
bool callbacks = m_state->m_callback;
bool lastScreen = (GetMythMainWindow()->GetMainStack()
->TotalScreens() == 1);
QString menuaction = "UPMENU";
QString selExit = "EXITING_APP_PROMPT";
if (action == "EXIT")
selExit = "EXITING_APP";
if (!m_allocedstate)
handleAction(menuaction);
else if (m_state->m_killable)
{
m_wantpop = true;
if (callbacks)
{
QString sel = "EXITING_MENU";
m_state->m_callback(m_state->m_callbackdata, sel);
}
if (lastScreen)
{
if (callbacks)
m_state->m_callback(m_state->m_callbackdata, selExit);
QCoreApplication::exit();
}
}
else if ((action == "EXIT" || action == "EXITPROMPT" ||
(action == "ESCAPE" &&
(QCoreApplication::applicationName() ==
MYTH_APPNAME_MYTHTV_SETUP))) && lastScreen)
{
if (callbacks)
m_state->m_callback(m_state->m_callbackdata, selExit);
else
{
QCoreApplication::exit();
m_wantpop = true;
}
}
}
else if (action == "HELP")
{
aboutScreen();
}
else if (action == "EJECT")
{
handleAction(action);
}
else
handled = false;
}
if (!handled && MythScreenType::keyPressEvent(event))
handled = true;
m_ignorekeys = false;
if (m_wantpop)
m_ScreenStack->PopScreen();
return handled;
}