本文整理汇总了C++中ActionList::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionList::insert方法的具体用法?C++ ActionList::insert怎么用?C++ ActionList::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionList
的用法示例。
在下文中一共展示了ActionList::insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
const CKeyBindings::ActionList& CKeyBindings::GetActionList(const CKeySet& ks) const
{
static const ActionList empty;
const ActionList* alPtr = ∅
if (ks.AnyMod()) {
KeyMap::const_iterator it = bindings.find(ks);
if (it != bindings.end()) {
alPtr = &(it->second);
}
}
else {
// have to check for an AnyMod keyset as well as the normal one
CKeySet anyMod = ks;
anyMod.SetAnyBit();
KeyMap::const_iterator nit = bindings.find(ks);
KeyMap::const_iterator ait = bindings.find(anyMod);
const bool haveNormal = (nit != bindings.end());
const bool haveAnyMod = (ait != bindings.end());
if (haveNormal && !haveAnyMod) {
alPtr = &(nit->second);
}
else if (!haveNormal && haveAnyMod) {
alPtr = &(ait->second);
}
else if (haveNormal && haveAnyMod) {
// combine the two lists (normal first)
static ActionList merged; //FIXME switch to thread_local when all buildbots are using >=gcc4.7
merged = nit->second;
merged.insert(merged.end(), ait->second.begin(), ait->second.end());
alPtr = &merged;
}
}
if (debugEnabled) {
LOG("GetActions: hex=0x%02X acii=\"%s\":", ks.Key(), ks.GetString(false).c_str());
if (alPtr != &empty) {
int i = 1;
for (const auto& a: *alPtr) {
LOG(" %i. action=\"%s\" rawline=\"%s\" shortcut=\"%s\"", i++, a.command.c_str(), a.rawline.c_str(), a.boundWith.c_str());
}
} else {
LOG(" EMPTY");
}
}
return *alPtr;
}
示例2: addActions
void PromotionTaskMenu::addActions(QDesignerFormWindowInterface *fw, unsigned flags,
ActionList &actionList)
{
Q_ASSERT(m_widget);
const int previousSize = actionList.size();
const PromotionState promotionState = createPromotionActions(fw);
// Promotion candidates/demote
actionList += m_promotionActions;
// Edit action depending on context
switch (promotionState) {
case CanPromote:
actionList += m_EditPromoteToAction;
break;
case CanDemote:
if (!(flags & SuppressGlobalEdit))
actionList += m_globalEditAction;
if (!languageExtension(fw->core())) {
actionList += separatorAction(this);
actionList += m_EditSignalsSlotsAction;
}
break;
default:
if (!(flags & SuppressGlobalEdit))
actionList += m_globalEditAction;
break;
}
// Add separators if required
if (actionList.size() > previousSize) {
if (flags & LeadingSeparator)
actionList.insert(previousSize, separatorAction(this));
if (flags & TrailingSeparator)
actionList += separatorAction(this);
}
}