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


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

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


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

示例1: foreach

Core::ActionContainer *FormEditorW::createPreviewStyleMenu(Core::ActionManager *am,
                                                            QActionGroup *actionGroup)
{
    const QString menuId = QLatin1String(M_FORMEDITOR_PREVIEW);
    Core::ActionContainer *menuPreviewStyle = am->createMenu(M_FORMEDITOR_PREVIEW);
    menuPreviewStyle->menu()->setTitle(tr("Preview in"));

    // The preview menu is a list of invisible actions for the embedded design
    // device profiles (integer data) followed by a separator and the styles
    // (string data). Make device profiles update their text and hide them
    // in the configuration dialog.
    const QList<QAction*> actions = actionGroup->actions();

    const QString deviceProfilePrefix = QLatin1String("DeviceProfile");
    const QChar dot = QLatin1Char('.');

    foreach (QAction* a, actions) {
        QString name = menuId;
        name += dot;
        const QVariant data = a->data();
        const bool isDeviceProfile = data.type() == QVariant::Int;
        if (isDeviceProfile) {
            name += deviceProfilePrefix;
            name += dot;
        }
        name += data.toString();
        Core::Command *command = am->registerAction(a, Core::Id(name), m_contexts);
        bindShortcut(command, a);
        if (isDeviceProfile) {
            command->setAttribute(Core::Command::CA_UpdateText);
            command->setAttribute(Core::Command::CA_NonConfigurable);
        }
        menuPreviewStyle->addAction(command);
    }
开发者ID:AtlantisCD9,项目名称:Qt,代码行数:34,代码来源:formeditorw.cpp

示例2: initialize

bool ImportExportPlugin::initialize(const QStringList& args, QString *errMsg)
{
    Q_UNUSED(args);
    Q_UNUSED(errMsg);

    // Add Menu entry
    Core::ActionManager* am = Core::ICore::instance()->actionManager();
    Core::ActionContainer* ac = am->actionContainer(Core::Constants::M_FILE);

    Core::Command* cmd = am->registerAction(new QAction(this),
                                            "ImportExportPlugin.ImportExport",
                                            QList<int>() <<
                                            Core::Constants::C_GLOBAL_ID);
    cmd->setDefaultKeySequence(QKeySequence("Ctrl+S"));
    cmd->action()->setText(tr("GCS Settings Import/Export..."));

//    ac->menu()->addSeparator();
//    ac->appendGroup("ImportExport");
//    ac->addAction(cmd, "ImportExport");
    ac->addAction(cmd, Core::Constants::G_FILE_SAVE);


    connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(importExport()));

    return true;
}
开发者ID:EATtomatoes,项目名称:TauLabs,代码行数:26,代码来源:importexportplugin.cpp

示例3: initialize

bool ExamplePlugin::initialize(const QStringList &arguments, QString *errorString)
{
    // Register objects in the plugin manager's object pool
    // Load settings
    // Add actions to menus
    // Connect to other plugins' signals
    // In the initialize function, a plugin can be sure that the plugins it
    // depends on have initialized their members.

    Q_UNUSED(arguments)
    Q_UNUSED(errorString)

//! [add action]
    QAction *action = new QAction(tr("Example action"), this);
    Core::Command *cmd = Core::ActionManager::registerAction(action, Constants::ACTION_ID,
                                            Core::Context(Core::Constants::C_GLOBAL));
    cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Meta+A")));
    connect(action, SIGNAL(triggered()), this, SLOT(triggerAction()));
//! [add action]
//! [add menu]
    Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::MENU_ID);
    menu->menu()->setTitle(tr("Example"));
    menu->addAction(cmd);
    Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu);
//! [add menu]

    return true;
}
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:28,代码来源:exampleplugin.cpp

示例4: createActions

void ActionHandler::createActions()
{
    Core::ActionContainer *medit = Core::ActionManager::actionContainer(Core::Constants::M_EDIT);

    d->undoAction = registerCommand(Core::Constants::UNDO, [this]() { undo(); })->action();
    d->redoAction = registerCommand(Core::Constants::REDO, [this]() { redo(); })->action();
    d->cutAction = registerCommand(Core::Constants::CUT, [this]() { cut(); })->action();
    d->copyAction = registerCommand(Core::Constants::COPY, [this]() { copy(); })->action();
    d->pasteAction = registerCommand(Core::Constants::PASTE, [this]() { paste(); })->action();
    Core::Command *removeCommand = registerCommand(
                Constants::REMOVE_SELECTED_ELEMENTS, [this]() { removeSelectedElements(); }, true,
                tr("&Remove"), QKeySequence::Delete);
    medit->addAction(removeCommand, Core::Constants::G_EDIT_COPYPASTE);
    d->removeAction = removeCommand->action();
    Core::Command *deleteCommand = registerCommand(
                Constants::DELETE_SELECTED_ELEMENTS, [this]() { deleteSelectedElements(); }, true,
                tr("&Delete"), QKeySequence(QStringLiteral("Ctrl+D")));
    medit->addAction(deleteCommand, Core::Constants::G_EDIT_COPYPASTE);
    d->deleteAction = deleteCommand->action();
    d->selectAllAction = registerCommand(Core::Constants::SELECTALL, [this]() { selectAll(); })->action();
    registerCommand(Constants::ACTION_ADD_PACKAGE, nullptr);
    registerCommand(Constants::ACTION_ADD_COMPONENT, nullptr);
    registerCommand(Constants::ACTION_ADD_CLASS, nullptr);
    registerCommand(Constants::ACTION_ADD_CANVAS_DIAGRAM, nullptr);
}
开发者ID:hoangHEDSPI,项目名称:qt-creator,代码行数:25,代码来源:actionhandler.cpp

示例5: initialize

/**
  * Add Logging plugin to File menu
  */
bool LoggingPlugin::initialize(const QStringList& args, QString *errMsg)
{
    Q_UNUSED(args);
    Q_UNUSED(errMsg);

    loggingThread = NULL;


    // Add Menu entry
    Core::ActionManager* am = Core::ICore::instance()->actionManager();
    Core::ActionContainer* ac = am->actionContainer(Core::Constants::M_TOOLS);

    // Command to start logging
    Core::Command* cmd = am->registerAction(new QAction(this),
                                            "LoggingPlugin.Logging",
                                            QList<int>() <<
                                            Core::Constants::C_GLOBAL_ID);
    cmd->setDefaultKeySequence(QKeySequence("Ctrl+L"));
    cmd->action()->setText("Start logging...");

    ac->menu()->addSeparator();
    ac->appendGroup("Logging");
    ac->addAction(cmd, "Logging");

    connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(toggleLogging()));


    mf = new LoggingGadgetFactory(this);
    addAutoReleasedObject(mf);

    // Map signal from end of replay to replay stopped
    connect(getLogfile(),SIGNAL(replayFinished()), this, SLOT(replayStopped()));

    return true;
}
开发者ID:mcu786,项目名称:my_OpenPilot_mods,代码行数:38,代码来源:loggingplugin.cpp

示例6: QObject

UAVSettingsImportExportFactory::UAVSettingsImportExportFactory(QObject *parent) : QObject(parent)
{
    // Add Menu entry
    Core::ActionManager *am   = Core::ICore::instance()->actionManager();
    Core::ActionContainer *ac = am->actionContainer(Core::Constants::M_FILE);
    Core::Command *cmd = am->registerAction(new QAction(this),
                                            "UAVSettingsImportExportPlugin.UAVSettingsExport",
                                            QList<int>() <<
                                            Core::Constants::C_GLOBAL_ID);

    cmd->setDefaultKeySequence(QKeySequence("Ctrl+E"));
    cmd->action()->setText(tr("Export UAV Settings..."));
    ac->addAction(cmd, Core::Constants::G_FILE_SAVE);
    connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(exportUAVSettings()));

    cmd = am->registerAction(new QAction(this),
                             "UAVSettingsImportExportPlugin.UAVSettingsImport",
                             QList<int>() <<
                             Core::Constants::C_GLOBAL_ID);
    cmd->setDefaultKeySequence(QKeySequence("Ctrl+I"));
    cmd->action()->setText(tr("Import UAV Settings..."));
    ac->addAction(cmd, Core::Constants::G_FILE_SAVE);
    connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(importUAVSettings()));

    ac  = am->actionContainer(Core::Constants::M_HELP);
    cmd = am->registerAction(new QAction(this),
                             "UAVSettingsImportExportPlugin.UAVDataExport",
                             QList<int>() <<
                             Core::Constants::C_GLOBAL_ID);
    cmd->action()->setText(tr("Export UAV Data..."));
    ac->addAction(cmd, Core::Constants::G_HELP_HELP);
    connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(exportUAVData()));
}
开发者ID:MorS25,项目名称:OpenPilot,代码行数:33,代码来源:uavsettingsimportexportfactory.cpp

示例7: initialize

bool ClangFormat::initialize()
{
    Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::ClangFormat::MENU_ID);
    menu->menu()->setTitle(tr("&ClangFormat"));

    m_formatFile = new QAction(BeautifierPlugin::msgFormatCurrentFile(), this);
    Core::Command *cmd
            = Core::ActionManager::registerAction(m_formatFile,
                                                  Constants::ClangFormat::ACTION_FORMATFILE);
    menu->addAction(cmd);
    connect(m_formatFile, &QAction::triggered, this, &ClangFormat::formatFile);

    m_formatRange = new QAction(BeautifierPlugin::msgFormatAtCursor(), this);
    cmd = Core::ActionManager::registerAction(m_formatRange,
                                              Constants::ClangFormat::ACTION_FORMATATCURSOR);
    menu->addAction(cmd);
    connect(m_formatRange, &QAction::triggered, this, &ClangFormat::formatAtCursor);

    m_disableFormattingSelectedText
        = new QAction(BeautifierPlugin::msgDisableFormattingSelectedText(), this);
    cmd = Core::ActionManager::registerAction(
        m_disableFormattingSelectedText, Constants::ClangFormat::ACTION_DISABLEFORMATTINGSELECTED);
    menu->addAction(cmd);
    connect(m_disableFormattingSelectedText, &QAction::triggered,
            this, &ClangFormat::disableFormattingSelectedText);

    Core::ActionManager::actionContainer(Constants::MENU_ID)->addMenu(menu);

    connect(m_settings, &ClangFormatSettings::supportedMimeTypesChanged,
            [this] { updateActions(Core::EditorManager::currentEditor()); });

    new ClangFormatOptionsPage(m_settings, this);

    return true;
}
开发者ID:choenig,项目名称:qt-creator,代码行数:35,代码来源:clangformat.cpp

示例8: setupFilterMenuItems

void FindPlugin::setupFilterMenuItems()
{
    QList<IFindFilter*> findInterfaces =
        ExtensionSystem::PluginManager::getObjects<IFindFilter>();
    Core::Command *cmd;
    Core::Context globalcontext(Core::Constants::C_GLOBAL);

    Core::ActionContainer *mfindadvanced = Core::ActionManager::actionContainer(Constants::M_FIND_ADVANCED);
    d->m_filterActions.clear();
    bool haveEnabledFilters = false;
    const Core::Id base("FindFilter.");
    foreach (IFindFilter *filter, findInterfaces) {
        QAction *action = new QAction(QLatin1String("    ") + filter->displayName(), this);
        bool isEnabled = filter->isEnabled();
        if (isEnabled)
            haveEnabledFilters = true;
        action->setEnabled(isEnabled);
        action->setData(qVariantFromValue(filter));
        cmd = Core::ActionManager::registerAction(action,
            base.withSuffix(filter->id()), globalcontext);
        cmd->setDefaultKeySequence(filter->defaultShortcut());
        mfindadvanced->addAction(cmd);
        d->m_filterActions.insert(filter, action);
        connect(action, SIGNAL(triggered(bool)), this, SLOT(openFindFilter()));
        connect(filter, SIGNAL(enabledChanged(bool)), this, SLOT(filterChanged()));
    }
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:26,代码来源:findplugin.cpp

示例9: connect

bool Tester::Internal::Plugin::initialize(const QStringList &arguments, QString *errorString)
{
    // Register objects in the plugin manager's object pool
    // Load settings
    // Add actions to menus
    // Connect to other plugins' signals
    // In the initialize method, a plugin can be sure that the plugins it
    // depends on have initialized their members.
    
    Q_UNUSED(arguments)
    Q_UNUSED(errorString)
    
    Core::Command *cmd = Core::ActionManager::registerAction(Controller->startAction(), Constants::ACTION_ID,
                                                             Core::Context(Core::Constants::C_GLOBAL));
    cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Meta+A")));
    connect(Controller->startAction(), SIGNAL(triggered()), this, SLOT(triggerAction()));
    
    Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::MENU_ID);
    menu->menu()->setTitle(tr("TesterPlugin"));
    menu->addAction(cmd);
    Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu);
    
    MonitoringViewFactory = new Tester::Internal::MonitoringViewFactory;
    MonitoringViewFactory->setController(Controller);
    addAutoReleasedObject(MonitoringViewFactory);

    Mode = new Tester::Internal::Mode(this);
    Mode->setController(Controller);
    addAutoReleasedObject(Mode);

    return true;

}
开发者ID:rovan,项目名称:tester,代码行数:33,代码来源:testerplugin.cpp

示例10: initialize

bool DoNothingPlugin::initialize(const QStringList& args, QString *errMsg)
{
    Q_UNUSED(args);
    Q_UNUSED(errMsg);

    // Fetch the action manager
    Core::ActionManager* am = Core::ICore::instance()->actionManager();

    // Create a DoNothing menu
    Core::ActionContainer* ac = am->createMenu("DoNothingPlugin.DoNothingMenu");
    ac->menu()->setTitle("DoNothing");

    // Create a command for "DoNothing".
    QAction *action = new QAction(tr("DoNothing"),this);
    Core::Command* cmd = am->registerAction(action,
        QLatin1String("DoNothingPlugin.DoNothing"),
        Core::Context(Core::Constants::C_GLOBAL));

    // Add DoNothing menu to the menubar
    am->actionContainer(Core::Constants::M_TOOLS)->addMenu(ac, Core::Constants::G_DEFAULT_THREE);

    // Add the "DoNothing" action to the DoNothing menu
    ac->addAction(cmd);

    // Connect the action
    connect(action, SIGNAL(triggered(bool)), this, SLOT(performAction()));
    return true;
}
开发者ID:yinyunqiao,项目名称:qtcreator,代码行数:28,代码来源:donothingplugin.cpp

示例11: QObject

ActionManager::ActionManager(QObject *parent) :
    QObject(parent),
    runAction(new QAction(QIcon(":/icons/images/run.png"), tr("Run tests"), this)),
    waitAction(new QAction(QIcon(":/icons/images/stop.png"), tr("Stop coverage execution"), this)),
    renderAction(new QAction(QIcon(":/icons/images/render.png"), tr("Show code coverage"), this))
{
    renderAction->setCheckable(true);

    // Add action to menu
    Core::ActionManager *pluginActionManager = Core::ICore::actionManager();           
    Core::Command *runCommand = pluginActionManager->registerAction(runAction, RUN_ACTION_ID, Core::Context(Core::Constants::C_GLOBAL));
    Core::Command *renderCommand = pluginActionManager->registerAction(renderAction, RENDER_ACTION_ID, Core::Context(Core::Constants::C_GLOBAL));
    runCommand->setKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_E);
    renderCommand->setKeySequence(Qt::CTRL + Qt::Key_H);

    Core::ActionContainer *menu = pluginActionManager->createMenu(MENU_ID);
    menu->menu()->setTitle(tr("CodeCoverage"));
    menu->addAction(runCommand);    
    menu->addAction(renderCommand);
    pluginActionManager->actionContainer(Core::Constants::M_TOOLS)->addMenu(menu);

    // Add action as icon to left bar
    Core::ModeManager *modeManager = Core::ModeManager::instance();
    modeManager->addAction(runAction, RUN_ACTION_PRIORITY);
    modeManager->addAction(waitAction, WAIT_ACTION_PRIORITY);
}
开发者ID:3Hren,项目名称:QtCreatorCoveragePlugin,代码行数:26,代码来源:ActionManager.cpp

示例12: createMenu

void TfsPlugin::createMenu()
{
    Core::Context context(Core::Constants::C_GLOBAL);

    // Create menu item for Mercurial
    tfsContainer = Core::ActionManager::createMenu("Tfs.TfsMenu");
    QMenu *menu = tfsContainer->menu();
    menu->setTitle(tr("&TFS"));


    createFileActions(context);
    tfsContainer->addSeparator(context);
    createDirectoryActions(context);
    tfsContainer->addSeparator(context);
    createRepositoryActions(context);
    tfsContainer->addSeparator(context);
    createRepositoryManagementActions(context);
    tfsContainer->addSeparator(context);
    createLessUsedActions(context);

    // Request the Tools menu and add the Tfs menu to it
    Core::ActionContainer *toolsMenu = Core::ActionManager::actionContainer(Core::Id(Core::Constants::M_TOOLS));
    toolsMenu->addMenu(tfsContainer);
    m_menuAction = tfsContainer->menu()->menuAction();
}
开发者ID:gaoxiaojun,项目名称:tfs,代码行数:25,代码来源:tfsplugin.cpp

示例13: aboutToShowRecentFiles

/** \brief Populate recent files menu */
void MainWindow::aboutToShowRecentFiles()
{
    Core::ActionContainer *aci = actionManager()->actionContainer(Core::Constants::M_FILE_RECENTFILES);
    aci->clear();

    foreach (const QString &fileName, fileManager()->recentFiles()) {
        QAction *action = aci->menu()->addAction(fileName);
        action->setData(fileName);
        connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile()));
    }
开发者ID:NyFanomezana,项目名称:freemedforms,代码行数:11,代码来源:mainwindow.cpp

示例14: initialize

/** \brief Create the menubar and the MainWindow actions. */
bool MainWindow::initialize(const QStringList &arguments, QString *errorString)
{
    Q_UNUSED(arguments);
    Q_UNUSED(errorString);
    // create menus
    createFileMenu();
    Core::ActionContainer *fmenu = actionManager()->actionContainer(Core::Constants::M_FILE);
    connect(fmenu->menu(), SIGNAL(aboutToShow()),this, SLOT(aboutToShowRecentFiles()));
    createEditMenu();
    createConfigurationMenu();
    createHelpMenu();

    Core::MainWindowActions actions;
    actions.setFileActions(
            Core::MainWindowActions::A_FileNew  |
            Core::MainWindowActions::A_FileOpen |
            Core::MainWindowActions::A_FileSave |
            Core::MainWindowActions::A_FileSaveAs |
            Core::MainWindowActions::A_FilePrint |
            Core::MainWindowActions::A_FilePrintPreview |
            Core::MainWindowActions::A_FileQuit
            );
    actions.setConfigurationActions(
            Core::MainWindowActions::A_AppPreferences |
            Core::MainWindowActions::A_LanguageChange
            );
    actions.setHelpActions(
            Core::MainWindowActions::A_AppAbout |
            Core::MainWindowActions::A_PluginsAbout |
            Core::MainWindowActions::A_AppHelp |
            Core::MainWindowActions::A_DebugDialog |
            Core::MainWindowActions::A_CheckUpdate //|
//            Core::MainWindowActions::A_QtAbout
            );
    actions.createEditActions(true);
    createActions(actions);

    connectFileActions();
    connectConfigurationActions();
    connectHelpActions();

    // Creating MainWindow interface
//    m_ui = new Internal::Ui::MainWindow();
//    m_ui->setupUi(this);
//    m_ui->padTextEdit->toogleToolbar(true);
//    resize(1024, 768);
//    m_ui->splitterMain->setSizes(QList<int>() << 150);
//    m_ui->splitterErrors->setSizes(QList<int>() << 0 << 100);

    return true;
}
开发者ID:eads77m,项目名称:freemedforms,代码行数:52,代码来源:mainwindow.cpp

示例15: initialize

bool Uncrustify::initialize()
{
    Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::Uncrustify::MENU_ID);
    menu->menu()->setTitle(QLatin1String(Constants::Uncrustify::DISPLAY_NAME));

    m_formatFile = new QAction(BeautifierPlugin::msgFormatCurrentFile(), this);
    Core::Command *cmd
            = Core::ActionManager::registerAction(m_formatFile,
                                                  Constants::Uncrustify::ACTION_FORMATFILE,
                                                  Core::Context(Core::Constants::C_GLOBAL));
    menu->addAction(cmd);
    connect(m_formatFile, SIGNAL(triggered()), this, SLOT(formatFile()));

    Core::ActionManager::actionContainer(Constants::MENU_ID)->addMenu(menu);

    return true;
}
开发者ID:beyondyuanshu,项目名称:qt-creator,代码行数:17,代码来源:uncrustify.cpp


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