本文整理汇总了C++中core::Context::add方法的典型用法代码示例。如果您正苦于以下问题:C++ Context::add方法的具体用法?C++ Context::add怎么用?C++ Context::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core::Context
的用法示例。
在下文中一共展示了Context::add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例3: 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);
}
示例4: addContext
void TableView::addContext(const Core::Context &context)
{
Core::Context current = d->m_Context->context();
current.add(context);
d->m_Context->setContext(current);
}
示例5: setupActions
void FormEditorW::setupActions()
{
Core::ActionManager *am = Core::ICore::actionManager();
Core::Command *command;
//menus
Core::ActionContainer *medit =
am->actionContainer(Core::Constants::M_EDIT);
Core::ActionContainer *mtools =
am->actionContainer(Core::Constants::M_TOOLS);
Core::ActionContainer *mformtools =
am->createMenu(M_FORMEDITOR);
mformtools->menu()->setTitle(tr("For&m Editor"));
mtools->addMenu(mformtools);
//overridden actions
bindShortcut(am->registerAction(m_fwm->actionUndo(), Core::Constants::UNDO, m_contexts), m_fwm->actionUndo());
bindShortcut(am->registerAction(m_fwm->actionRedo(), Core::Constants::REDO, m_contexts), m_fwm->actionRedo());
bindShortcut(am->registerAction(m_fwm->actionCut(), Core::Constants::CUT, m_contexts), m_fwm->actionCut());
bindShortcut(am->registerAction(m_fwm->actionCopy(), Core::Constants::COPY, m_contexts), m_fwm->actionCopy());
bindShortcut(am->registerAction(m_fwm->actionPaste(), Core::Constants::PASTE, m_contexts), m_fwm->actionPaste());
bindShortcut(am->registerAction(m_fwm->actionSelectAll(), Core::Constants::SELECTALL, m_contexts), m_fwm->actionSelectAll());
m_actionPrint = new QAction(this);
bindShortcut(am->registerAction(m_actionPrint, Core::Constants::PRINT, m_contexts), m_actionPrint);
connect(m_actionPrint, SIGNAL(triggered()), this, SLOT(print()));
//'delete' action. Do not set a shortcut as Designer handles
// the 'Delete' key by event filter. Setting a shortcut triggers
// buggy behaviour on Mac (Pressing Delete in QLineEdit removing the widget).
command = am->registerAction(m_fwm->actionDelete(), Core::Id("FormEditor.Edit.Delete"), m_contexts);
bindShortcut(command, m_fwm->actionDelete());
command->setAttribute(Core::Command::CA_Hide);
medit->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
m_actionGroupEditMode = new QActionGroup(this);
m_actionGroupEditMode->setExclusive(true);
connect(m_actionGroupEditMode, SIGNAL(triggered(QAction*)), this, SLOT(activateEditMode(QAction*)));
m_modeActionSeparator = new QAction(this);
m_modeActionSeparator->setSeparator(true);
command = am->registerAction(m_modeActionSeparator, Core::Id("FormEditor.Sep.ModeActions"), m_contexts);
medit->addAction(command, Core::Constants::G_EDIT_OTHER);
m_toolActionIds.push_back(Core::Id("FormEditor.WidgetEditor"));
createEditModeAction(m_actionGroupEditMode, m_contexts, am, medit,
tr("Edit Widgets"), m_toolActionIds.back(),
EditModeWidgetEditor, QLatin1String("widgettool.png"), tr("F3"));
m_toolActionIds.push_back(Core::Id("FormEditor.SignalsSlotsEditor"));
createEditModeAction(m_actionGroupEditMode, m_contexts, am, medit,
tr("Edit Signals/Slots"), m_toolActionIds.back(),
EditModeSignalsSlotEditor, QLatin1String("signalslottool.png"), tr("F4"));
m_toolActionIds.push_back(Core::Id("FormEditor.BuddyEditor"));
createEditModeAction(m_actionGroupEditMode, m_contexts, am, medit,
tr("Edit Buddies"), m_toolActionIds.back(),
EditModeBuddyEditor, QLatin1String("buddytool.png"));
m_toolActionIds.push_back(Core::Id("FormEditor.TabOrderEditor"));
createEditModeAction(m_actionGroupEditMode, m_contexts, am, medit,
tr("Edit Tab Order"), m_toolActionIds.back(),
EditModeTabOrderEditor, QLatin1String("tabordertool.png"));
//tool actions
m_toolActionIds.push_back(Core::Id("FormEditor.LayoutHorizontally"));
const QString horizLayoutShortcut = osMac ? tr("Meta+H") : tr("Ctrl+H");
addToolAction(m_fwm->actionHorizontalLayout(), am, m_contexts,
m_toolActionIds.back(), mformtools, horizLayoutShortcut);
m_toolActionIds.push_back(Core::Id("FormEditor.LayoutVertically"));
const QString vertLayoutShortcut = osMac ? tr("Meta+L") : tr("Ctrl+L");
addToolAction(m_fwm->actionVerticalLayout(), am, m_contexts,
m_toolActionIds.back(), mformtools, vertLayoutShortcut);
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,
//.........这里部分代码省略.........