本文整理汇总了C++中core::Command::setDescription方法的典型用法代码示例。如果您正苦于以下问题:C++ Command::setDescription方法的具体用法?C++ Command::setDescription怎么用?C++ Command::setDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core::Command
的用法示例。
在下文中一共展示了Command::setDescription方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.
}
}
}
示例2: initialize
bool QbsProjectManagerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments);
Q_UNUSED(errorMessage);
const Core::Context projectContext(::QbsProjectManager::Constants::PROJECT_ID);
const Core::Context globalcontext(Core::Constants::C_GLOBAL);
Core::FileIconProvider::registerIconOverlayForSuffix(QtSupport::Constants::ICON_QT_PROJECT, "qbs");
//create and register objects
addAutoReleasedObject(new QbsManager);
addAutoReleasedObject(new QbsBuildConfigurationFactory);
addAutoReleasedObject(new QbsBuildStepFactory);
addAutoReleasedObject(new QbsCleanStepFactory);
addAutoReleasedObject(new QbsInstallStepFactory);
addAutoReleasedObject(new QbsDeployConfigurationFactory);
addAutoReleasedObject(new QbsRunConfigurationFactory);
addAutoReleasedObject(new QbsProfilesSettingsPage);
//menus
// Build Menu:
Core::ActionContainer *mbuild =
Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT);
// PE Context menu for projects
Core::ActionContainer *mproject =
Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT);
Core::ActionContainer *msubproject =
Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_SUBPROJECTCONTEXT);
Core::ActionContainer *mfile =
Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_FILECONTEXT);
//register actions
Core::Command *command;
m_reparseQbs = new QAction(tr("Reparse Qbs"), this);
command = Core::ActionManager::registerAction(m_reparseQbs, Constants::ACTION_REPARSE_QBS, projectContext);
command->setAttribute(Core::Command::CA_Hide);
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD);
connect(m_reparseQbs, SIGNAL(triggered()), this, SLOT(reparseCurrentProject()));
m_reparseQbsCtx = new QAction(tr("Reparse Qbs"), this);
command = Core::ActionManager::registerAction(m_reparseQbsCtx, Constants::ACTION_REPARSE_QBS_CONTEXT, projectContext);
command->setAttribute(Core::Command::CA_Hide);
mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
connect(m_reparseQbsCtx, SIGNAL(triggered()), this, SLOT(reparseSelectedProject()));
m_buildFileCtx = new QAction(tr("Build"), this);
command = Core::ActionManager::registerAction(m_buildFileCtx, Constants::ACTION_BUILD_FILE_CONTEXT, projectContext);
command->setAttribute(Core::Command::CA_Hide);
mfile->addAction(command, ProjectExplorer::Constants::G_FILE_OTHER);
connect(m_buildFileCtx, SIGNAL(triggered()), this, SLOT(buildFileContextMenu()));
m_buildFile = new Utils::ParameterAction(tr("Build File"), tr("Build File \"%1\""),
Utils::ParameterAction::AlwaysEnabled, this);
command = Core::ActionManager::registerAction(m_buildFile, Constants::ACTION_BUILD_FILE, globalcontext);
command->setAttribute(Core::Command::CA_Hide);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDescription(m_buildFile->text());
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+B")));
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD);
connect(m_buildFile, SIGNAL(triggered()), this, SLOT(buildFile()));
m_buildProductCtx = new QAction(tr("Build"), this);
command = Core::ActionManager::registerAction(m_buildProductCtx, Constants::ACTION_BUILD_PRODUCT_CONTEXT, projectContext);
command->setAttribute(Core::Command::CA_Hide);
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
connect(m_buildProductCtx, SIGNAL(triggered()), this, SLOT(buildProductContextMenu()));
m_buildProduct = new Utils::ParameterAction(tr("Build Product"), tr("Build Product \"%1\""),
Utils::ParameterAction::AlwaysEnabled, this);
command = Core::ActionManager::registerAction(m_buildProduct, Constants::ACTION_BUILD_PRODUCT, globalcontext);
command->setAttribute(Core::Command::CA_Hide);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDescription(m_buildFile->text());
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Shift+B")));
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD);
connect(m_buildProduct, SIGNAL(triggered()), this, SLOT(buildProduct()));
m_buildSubprojectCtx = new QAction(tr("Build"), this);
command = Core::ActionManager::registerAction(m_buildSubprojectCtx, Constants::ACTION_BUILD_SUBPROJECT_CONTEXT, projectContext);
command->setAttribute(Core::Command::CA_Hide);
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
connect(m_buildSubprojectCtx, SIGNAL(triggered()), this, SLOT(buildSubprojectContextMenu()));
m_buildSubproject = new Utils::ParameterAction(tr("Build Subproject"), tr("Build Subproject \"%1\""),
Utils::ParameterAction::AlwaysEnabled, this);
command = Core::ActionManager::registerAction(m_buildSubproject, Constants::ACTION_BUILD_SUBPROJECT, globalcontext);
command->setAttribute(Core::Command::CA_Hide);
command->setAttribute(Core::Command::CA_UpdateText);
command->setDescription(m_buildFile->text());
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+B")));
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD);
connect(m_buildSubproject, SIGNAL(triggered()), this, SLOT(buildSubproject()));
// Connect
connect(ProjectTree::instance(), &ProjectTree::currentNodeChanged,
this, &QbsProjectManagerPlugin::nodeSelectionChanged);
//.........这里部分代码省略.........