• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ core::Context类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中core::Context的典型用法代码示例。如果您正苦于以下问题:C++ Context类的具体用法?C++ Context怎么用?C++ Context使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Context类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: polishActions

void DesignerActionManager::polishActions() const
{
    QList<ActionInterface* > actions =  Utils::filtered(designerActions(),
                                                        [](ActionInterface *action) { return action->type() != ActionInterface::ContextMenu; });

    Core::Context qmlDesignerFormEditorContext(Constants::C_QMLFORMEDITOR);
    Core::Context qmlDesignerNavigatorContext(Constants::C_QMLNAVIGATOR);

    Core::Context qmlDesignerUIContext;
    qmlDesignerUIContext.add(qmlDesignerFormEditorContext);
    qmlDesignerUIContext.add(qmlDesignerNavigatorContext);

    for (auto *action : actions) {
        if (!action->menuId().isEmpty()) {
            const QString id =
                    QString("QmlDesigner.%1").arg(QString::fromLatin1(action->menuId()));

            Core::Command *cmd = Core::ActionManager::registerAction(action->action(), id.toLatin1().constData(), qmlDesignerUIContext);

            cmd->setDefaultKeySequence(action->action()->shortcut());
            cmd->setDescription(action->action()->toolTip());

            action->action()->setToolTip(cmd->action()->toolTip());
            action->action()->setShortcut(cmd->action()->shortcut());
            action->action()->setShortcutContext(Qt::WidgetShortcut); //Hack to avoid conflicting shortcuts. We use the Core::Command for the shortcut.
        }
    }
}
开发者ID:kai66673,项目名称:qt-creator,代码行数:28,代码来源:designeractionmanager.cpp


示例2: newEntity

Handle<Entity> newEntity(core::Context &context, World &world, const GCTP_TYPEINFO &typeinfo, const _TCHAR *name, const _TCHAR *srcfilename)
{
    if(srcfilename) context.load(srcfilename);
    Pointer<Entity> ret = context.create(typeinfo, name).lock();
    if(ret) {
        if(srcfilename) ret->setUp(srcfilename);
        ret->enter(world);
    }
    return ret.get();
}
开发者ID:Emulyator,项目名称:gamecatapult,代码行数:10,代码来源:entity.cpp


示例3: calculateContext

    void calculateContext()
    {
        Core::Context context;
        if (m_Actions & Constants::MoveUpDown)
            context.add(Constants::C_BASIC_MOVE);

        if (m_Actions & Constants::AddRemove)
            context.add(Constants::C_BASIC_ADDREMOVE);

        m_Context->setContext(context);
    }
开发者ID:NyFanomezana,项目名称:freemedforms,代码行数:11,代码来源:tableview.cpp


示例4: isScriptable

bool Action::isScriptable(const Core::Context &context) const
{
    if (context == m_context && m_scriptableMap.contains(m_action->action()))
        return m_scriptableMap.value(m_action->action());

    for (int i = 0; i < context.size(); ++i) {
        if (QAction *a = m_contextActionMap.value(context.at(i), 0)) {
            if (m_scriptableMap.contains(a) && m_scriptableMap.value(a))
                return true;
        }
    }
    return false;
}
开发者ID:anchowee,项目名称:QtCreator,代码行数:13,代码来源:command.cpp


示例5: updateContext

void ProjectTree::updateContext()
{
    Core::Context oldContext;
    oldContext.add(m_lastProjectContext);

    Core::Context newContext;
    if (m_currentProject) {
        newContext.add(m_currentProject->projectContext());
        newContext.add(m_currentProject->projectLanguages());

        m_lastProjectContext = newContext;
    } else {
        m_lastProjectContext = Core::Context();
    }

    Core::ICore::updateAdditionalContexts(oldContext, newContext);
}
开发者ID:KeeganRen,项目名称:qt-creator,代码行数:17,代码来源:projecttree.cpp


示例6: switch

void X86MasterAnalyzer::detectCallingConvention(core::Context &context, const core::ir::calling::CalleeId &calleeId) const {
    auto architecture = context.image()->architecture();

    auto setConvention = [&](const char *name) {
        context.conventions()->setConvention(calleeId, architecture->getCallingConvention(QLatin1String(name)));
    };

    switch (architecture->bitness()) {
        case 16:
            setConvention("cdecl16");
            break;
        case 32:
            setConvention("cdecl32");
            break;
        case 64:
            setConvention("amd64");
            break;
    }
}
开发者ID:jiaoyk,项目名称:snowman,代码行数:19,代码来源:X86MasterAnalyzer.cpp


示例7: addOverrideAction

void Action::addOverrideAction(QAction *action, const Core::Context &context, bool scriptable)
{
    if (Utils::HostOsInfo::isMacHost())
        action->setIconVisibleInMenu(false);
    if (isEmpty())
        m_action->initialize(action);
    if (context.isEmpty()) {
        m_contextActionMap.insert(0, action);
    } else {
        for (int i = 0; i < context.size(); ++i) {
            int k = context.at(i);
            if (m_contextActionMap.contains(k))
                qWarning("%s", qPrintable(msgActionWarning(action, k, m_contextActionMap.value(k, 0))));
            m_contextActionMap.insert(k, action);
        }
    }
    m_scriptableMap[action] = scriptable;
    setCurrentContext(m_context);
}
开发者ID:CNOT,项目名称:julia-studio,代码行数:19,代码来源:command.cpp


示例8: Embed

static int Embed(int argc, char **argv)
{
    Core::Context *ncx = initNidiumJS();
    JSContext *cx      = ncx->getNJS()->getJSContext();

    if (argc <= 1) {
        printf("$ %s <path> [prefix] [> out]\n", argv[0]);
        return 1;
    }

    DIR *dir = opendir(argv[1]);
    if (!dir) {
        fprintf(stderr, "Can't open dir %s\n", argv[1]);
    }

    JS_BeginRequest(cx);

    JSNFS *nfs = new JSNFS(cx);

    bool ok;
    if (argc == 3) {
        std::string prefix = "/";
        prefix += argv[2];

        fprintf(stderr, "Create prefix %s...\n", prefix.c_str());

        nfs->mkdir(prefix.c_str(), strlen(prefix.c_str()));

        ok = listdir(nfs, dir, argv[1], strlen(argv[1]));
    } else {
        ok = listdir(nfs, dir, argv[1], strlen(argv[1]));
    }

    nfs->save(DIR2NFS_OUTPUT);

    JS_EndRequest(cx);

    delete ncx;

    return ok ? 0 : 1;
}
开发者ID:nidium,项目名称:Nidium,代码行数:41,代码来源:dir2nvfs.cpp


示例9: switch

void X86MasterAnalyzer::detectCallingConvention(core::Context &context, const core::ir::calling::CalleeId &calleeId) const {
    const auto &platform = context.image()->platform();
    auto architecture = platform.architecture();

    auto setConvention = [&](const char *name) {
        context.conventions()->setConvention(calleeId, architecture->getCallingConvention(QLatin1String(name)));
    };

    switch (architecture->bitness()) {
        case 16:
            setConvention("cdecl16");
            break;
        case 32:
            setConvention("cdecl32");
            break;
        case 64:
            if (platform.operatingSystem() == core::image::Platform::Windows) {
                setConvention("microsoft64");
            } else {
                setConvention("amd64");
            }
            break;
    }
}
开发者ID:8l,项目名称:snowman,代码行数:24,代码来源:X86MasterAnalyzer.cpp


示例10: setCurrentContext

void Shortcut::setCurrentContext(const Core::Context &context)
{
    foreach (int ctxt, m_context) {
        if (context.contains(ctxt)) {
            if (!m_shortcut->isEnabled()) {
                m_shortcut->setEnabled(true);
                emit activeStateChanged();
            }
            return;
        }
    }
    if (m_shortcut->isEnabled()) {
        m_shortcut->setEnabled(false);
        emit activeStateChanged();
    }
    return;
}
开发者ID:anchowee,项目名称:QtCreator,代码行数:17,代码来源:command.cpp


示例11: addContext

void TableView::addContext(const Core::Context &context)
{
    Core::Context current = d->m_Context->context();
    current.add(context);
    d->m_Context->setContext(current);
}
开发者ID:NyFanomezana,项目名称:freemedforms,代码行数:6,代码来源:tableview.cpp


示例12: material

Material_test::Material_test(Core::Context &ctx)
: App(ctx)
, m_timer(0.f)
, m_cube_entity(get_world())
, m_plane_entity(get_world())
, m_camera_entity(get_world())
, m_camera(m_camera_entity, ctx.get_width(), ctx.get_height())
{
  namespace Mat_utils = ::Test::Material_test_utils;
  
  ctx.set_title("Material Renderer");

  // ** Setup Entities ** //
  {
    // Move cube up so its not intersecting with plane.
    {
      m_cube_entity.set_name("Material Test Cube");
      
      const Core::Transform cube_trans(
        math::vec3_init(0.f, scene_cube_scale * 0.5f, 0.f),
        math::vec3_init(scene_cube_scale),
        math::quat_init()
      );
      
      Core::Entity_component::set_transform(m_cube_entity, cube_trans);
    }
    
    // Scale up plane
    {
      m_plane_entity.set_name("Material Test Plane");
      
      const Core::Transform scaled_up(
        math::vec3_zero(),
        math::vec3_init(scene_plane_scale, 1.f, scene_plane_scale),
        math::quat_init()
      );
      
      Core::Entity_component::set_transform(m_plane_entity, scaled_up);
    }

    // Back and up for the camera.
    {
      m_camera_entity.set_name("Material Test Camera");

      Core::Entity_component::set_transform(
        m_camera_entity,
        Common::Orbit_transform(0.f,
                                camera_tilt,
                                camera_distance,
                                camera_height)
      );
    }
  }

  // ** Create Materials ** //
  {
    // Creates the material and stores it in the out.
    auto add_material = [](const Core::Shader &shd,
                           const Core::Texture &tex,
                           const uint32_t index,
                           Core::Material *out)
    {
      char name[256];
      memset(name, 0, sizeof(name));
      sprintf(name, "test_material_%02d", index);
    
      Core::Material material(name);
      material.set_shader(shd);
      
      if(tex)
      {
        material.set_map_01(tex);
      }
      
      *out = material;
    };
    
    uint32_t curr_mat = 0;
    assert(curr_mat < Mat_utils::max_materials());
    add_material(Shader_factory::get_fullbright(), Texture_factory::get_dev_green(), curr_mat, &m_materials[curr_mat]);
    
    ++curr_mat;
    assert(curr_mat < Mat_utils::max_materials());
    add_material(Shader_factory::get_fullbright(), Texture_factory::get_dev_red(), curr_mat, &m_materials[curr_mat]);

    ++curr_mat;
    assert(curr_mat < Mat_utils::max_materials());
    add_material(Shader_factory::get_fullbright(), Texture_factory::get_dev_squares(), curr_mat, &m_materials[curr_mat]);

    ++curr_mat;
    assert(curr_mat < Mat_utils::max_materials());
    add_material(Shader_factory::get_fullbright(), Texture_factory::get_dev_squares_large(), curr_mat, &m_materials[curr_mat]);

    ++curr_mat;
    assert(curr_mat < Mat_utils::max_materials());
    add_material(Shader_factory::get_fullbright(), Texture_factory::get_dev_colored_squares(), curr_mat, &m_materials[curr_mat]);

    ++curr_mat;
    assert(curr_mat < Mat_utils::max_materials());
    add_material(Shader_factory::get_noise(), Core::Texture(), curr_mat, &m_materials[curr_mat]);
//.........这里部分代码省略.........
开发者ID:republic-of-almost,项目名称:fps_demo,代码行数:101,代码来源:material_test.cpp


示例13: setupActions


//.........这里部分代码省略.........
    m_toolActionIds.push_back(Core::Id("FormEditor.SplitHorizontal"));
    addToolAction(m_fwm->actionSplitHorizontal(), am, m_contexts,
                  m_toolActionIds.back(), mformtools);

    m_toolActionIds.push_back(Core::Id("FormEditor.SplitVertical"));
    addToolAction(m_fwm->actionSplitVertical(), am, m_contexts,
                  m_toolActionIds.back(), mformtools);

    m_toolActionIds.push_back(Core::Id("FormEditor.LayoutForm"));
    addToolAction(m_fwm->actionFormLayout(), am, m_contexts,
                  m_toolActionIds.back(),  mformtools);

    m_toolActionIds.push_back(Core::Id("FormEditor.LayoutGrid"));
    const QString gridShortcut = osMac ? tr("Meta+G") : tr("Ctrl+G");
    addToolAction(m_fwm->actionGridLayout(), am, m_contexts,
                  m_toolActionIds.back(),  mformtools, gridShortcut);

    m_toolActionIds.push_back(Core::Id("FormEditor.LayoutBreak"));
    addToolAction(m_fwm->actionBreakLayout(), am, m_contexts,
                  m_toolActionIds.back(), mformtools);

    m_toolActionIds.push_back(Core::Id("FormEditor.LayoutAdjustSize"));
    const QString adjustShortcut = osMac ? tr("Meta+J") : tr("Ctrl+J");
    addToolAction(m_fwm->actionAdjustSize(), am, m_contexts,
                  m_toolActionIds.back(),  mformtools, adjustShortcut);

    m_toolActionIds.push_back(Core::Id("FormEditor.SimplifyLayout"));
    addToolAction(m_fwm->actionSimplifyLayout(), am, m_contexts,
                  m_toolActionIds.back(),  mformtools);

    createSeparator(this, am, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator1"));

    addToolAction(m_fwm->actionLower(), am, m_contexts,
                  Core::Id("FormEditor.Lower"), mformtools);

    addToolAction(m_fwm->actionRaise(), am, m_contexts,
                  Core::Id("FormEditor.Raise"), mformtools);

    // Commands that do not go into the editor toolbar
    createSeparator(this, am, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator2"));

#if QT_VERSION >= 0x050000
    m_actionPreview = m_fwm->action(QDesignerFormWindowManagerInterface::DefaultPreviewAction);
#else
    m_actionPreview = m_fwm->actionDefaultPreview();
#endif
    QTC_ASSERT(m_actionPreview, return);
    addToolAction(m_actionPreview,  am,  m_contexts,
                   Core::Id("FormEditor.Preview"), mformtools, tr("Alt+Shift+R"));

    // Preview in style...
#if QT_VERSION >= 0x050000
    m_actionGroupPreviewInStyle = m_fwm->actionGroup(QDesignerFormWindowManagerInterface::StyledPreviewActionGroup);
#else
    m_actionGroupPreviewInStyle = m_fwm->actionGroupPreviewInStyle();
#endif

    Core::ActionContainer *previewAC = createPreviewStyleMenu(am, m_actionGroupPreviewInStyle);
    m_previewInStyleMenu = previewAC->menu();
    mformtools->addMenu(previewAC);
    setPreviewMenuEnabled(false);

    // Form settings
    createSeparator(this, am, m_contexts,  medit, Core::Id("FormEditor.Edit.Separator2"), Core::Constants::G_EDIT_OTHER);

    createSeparator(this, am, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator3"));

    m_actionSwitchSource = new QAction(tr("Switch Source/Form"), this);
    connect(m_actionSwitchSource, SIGNAL(triggered()), this, SLOT(switchSourceForm()));

    // Switch form/source in editor/design contexts.
    Core::Context switchContexts = m_contexts;
    switchContexts.add(Core::Constants::C_EDITORMANAGER);
    addToolAction(m_actionSwitchSource, am, switchContexts, Core::Id("FormEditor.FormSwitchSource"), mformtools,
                  tr("Shift+F4"));

    createSeparator(this, am, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator4"));
#if QT_VERSION >= 0x050000
    QAction *actionFormSettings = m_fwm->action(QDesignerFormWindowManagerInterface::FormWindowSettingsDialogAction);
#else
    QAction *actionFormSettings = m_fwm->actionShowFormWindowSettingsDialog();
#endif
    addToolAction(actionFormSettings, am, m_contexts, Core::Id("FormEditor.FormSettings"), mformtools);

    createSeparator(this, am, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator5"));
    m_actionAboutPlugins = new QAction(tr("About Qt Designer plugins...."), this);
    addToolAction(m_actionAboutPlugins,  am,  m_contexts,
                   Core::Id("FormEditor.AboutPlugins"), mformtools);
    connect(m_actionAboutPlugins,  SIGNAL(triggered()), m_fwm,
#if QT_VERSION >= 0x050000
            SLOT(showPluginDialog())
#else
            SLOT(aboutPlugins())
#endif
            );
    m_actionAboutPlugins->setEnabled(false);

    // FWM
    connect(m_fwm, SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface*)), this, SLOT(activeFormWindowChanged(QDesignerFormWindowInterface*)));
}
开发者ID:AtlantisCD9,项目名称:Qt,代码行数:101,代码来源:formeditorw.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ core::EditorManager类代码示例发布时间:2022-05-31
下一篇:
C++ core::Command类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap