本文整理汇总了C++中ActionList::count方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionList::count方法的具体用法?C++ ActionList::count怎么用?C++ ActionList::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionList
的用法示例。
在下文中一共展示了ActionList::count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ActionID
/** \fn KeyBindings::GetConflict(const QString&,const QString&,int&) const
* \brief Determine if adding a key would cause a conflict.
* \param context_name The name of the context.
* \param key The key to add.
* \param level The level of conflict if this returns an ActionID
* \return pointer to an ActionID if adding the key would cause a conflict.
*
* Conflicts occur if:
* \li the key is a jump point, but is bound elsewhere
* \li the key is already bound to a jumppoint.
* \li the key is bound to something in the global context.
* \li the key is bound to something else in the specified context
*
* If the method does not return NULL, check the value given to
* level. Warnings can be ignored (at the users disgression), but
* errors should be prevented no matter what.
*
* NOTE: If this returns a non-null pointer, the ActionID returned
* must be explicitly deleted with C++ "delete".
*/
ActionID *KeyBindings::GetConflict(
const QString &context_name, const QString &key, int &level) const
{
const ActionList ids = m_actionSet.GetActions(key);
// trying to bind a jumppoint to an already bound key
if ((context_name == ActionSet::kJumpContext) && (ids.count() > 0))
return new ActionID(ids[0]);
// check the contexts of the other bindings
for (int i = 0; i < ids.count(); i++)
{
// jump points, then global, then the same context
if (ids[i].GetContext() == ActionSet::kJumpContext)
{
level = KeyBindings::kKeyBindingError;
return new ActionID(ids[i]);
}
else if (ids[i].GetContext() == context_name)
{
level = KeyBindings::kKeyBindingError;
return new ActionID(ids[i]);
}
else if (ids[i].GetContext() == ActionSet::kGlobalContext)
{
level = KeyBindings::kKeyBindingWarning;
return new ActionID(ids[i]);
}
}
return NULL; // no conflicts
}
示例2: slotRemoveSelectedAction
void ToolBarEventFilter::slotRemoveSelectedAction()
{
QAction *action = qobject_cast<QAction*>(sender());
if (!action)
return;
QAction *a = qvariant_cast<QAction*>(action->data());
Q_ASSERT(a != 0);
QDesignerFormWindowInterface *fw = formWindow();
Q_ASSERT(fw);
const ActionList actions = m_toolBar->actions();
const int pos = actions.indexOf(a);
QAction *action_before = 0;
if (pos != -1 && actions.count() > pos + 1)
action_before = actions.at(pos + 1);
RemoveActionFromCommand *cmd = new RemoveActionFromCommand(fw);
cmd->init(m_toolBar, a, action_before);
fw->commandHistory()->push(cmd);
}