当前位置: 首页>>代码示例>>C++>>正文


C++ ActionList::insert方法代码示例

本文整理汇总了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;
}
开发者ID:spring,项目名称:spring,代码行数:48,代码来源:KeyBindings.cpp

示例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);
    }
}
开发者ID:kileven,项目名称:qt5,代码行数:36,代码来源:promotiontaskmenu.cpp


注:本文中的ActionList::insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。