本文整理汇总了C++中core::ICore::addContextObject方法的典型用法代码示例。如果您正苦于以下问题:C++ ICore::addContextObject方法的具体用法?C++ ICore::addContextObject怎么用?C++ ICore::addContextObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core::ICore
的用法示例。
在下文中一共展示了ICore::addContextObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QPlainTextEdit
OutputWindow::OutputWindow(Core::Context context, QWidget *parent)
: QPlainTextEdit(parent)
, m_formatter(0)
, m_enforceNewline(false)
, m_scrollToBottom(false)
, m_linksActive(true)
, m_mousePressed(false)
, m_maxLineCount(100000)
{
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
//setCenterOnScroll(false);
setFrameShape(QFrame::NoFrame);
setMouseTracking(true);
Core::ICore *core = Core::ICore::instance();
m_outputWindowContext = new Core::IContext;
m_outputWindowContext->setContext(context);
m_outputWindowContext->setWidget(this);
core->addContextObject(m_outputWindowContext);
QAction *undoAction = new QAction(this);
QAction *redoAction = new QAction(this);
QAction *cutAction = new QAction(this);
QAction *copyAction = new QAction(this);
QAction *pasteAction = new QAction(this);
QAction *selectAllAction = new QAction(this);
Core::ActionManager *am = core->actionManager();
am->registerAction(undoAction, Core::Constants::UNDO, context);
am->registerAction(redoAction, Core::Constants::REDO, context);
am->registerAction(cutAction, Core::Constants::CUT, context);
am->registerAction(copyAction, Core::Constants::COPY, context);
am->registerAction(pasteAction, Core::Constants::PASTE, context);
am->registerAction(selectAllAction, Core::Constants::SELECTALL, context);
connect(undoAction, SIGNAL(triggered()), this, SLOT(undo()));
connect(redoAction, SIGNAL(triggered()), this, SLOT(redo()));
connect(cutAction, SIGNAL(triggered()), this, SLOT(cut()));
connect(copyAction, SIGNAL(triggered()), this, SLOT(copy()));
connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste()));
connect(selectAllAction, SIGNAL(triggered()), this, SLOT(selectAll()));
connect(this, SIGNAL(undoAvailable(bool)), undoAction, SLOT(setEnabled(bool)));
connect(this, SIGNAL(redoAvailable(bool)), redoAction, SLOT(setEnabled(bool)));
connect(this, SIGNAL(copyAvailable(bool)), cutAction, SLOT(setEnabled(bool))); // OutputWindow never read-only
connect(this, SIGNAL(copyAvailable(bool)), copyAction, SLOT(setEnabled(bool)));
undoAction->setEnabled(false);
redoAction->setEnabled(false);
cutAction->setEnabled(false);
copyAction->setEnabled(false);
}
示例2: QPlainTextEdit
OutputWindow::OutputWindow(QWidget *parent)
: QPlainTextEdit(parent)
, m_enforceNewline(false)
, m_scrollToBottom(false)
{
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
//setCenterOnScroll(false);
setWindowTitle(tr("Application Output Window"));
setWindowIcon(QIcon(":/qt4projectmanager/images/window.png"));
setFrameShape(QFrame::NoFrame);
setMouseTracking(true);
static uint usedIds = 0;
Core::ICore *core = Core::ICore::instance();
QList<int> context;
context << core->uniqueIDManager()->uniqueIdentifier(QString(Constants::C_APP_OUTPUT) + QString().setNum(usedIds++));
m_outputWindowContext = new Core::BaseContext(this, context);
core->addContextObject(m_outputWindowContext);
QAction *undoAction = new QAction(this);
QAction *redoAction = new QAction(this);
QAction *cutAction = new QAction(this);
QAction *copyAction = new QAction(this);
QAction *pasteAction = new QAction(this);
QAction *selectAllAction = new QAction(this);
Core::ActionManager *am = core->actionManager();
am->registerAction(undoAction, Core::Constants::UNDO, context);
am->registerAction(redoAction, Core::Constants::REDO, context);
am->registerAction(cutAction, Core::Constants::CUT, context);
am->registerAction(copyAction, Core::Constants::COPY, context);
am->registerAction(pasteAction, Core::Constants::PASTE, context);
am->registerAction(selectAllAction, Core::Constants::SELECTALL, context);
connect(undoAction, SIGNAL(triggered()), this, SLOT(undo()));
connect(redoAction, SIGNAL(triggered()), this, SLOT(redo()));
connect(cutAction, SIGNAL(triggered()), this, SLOT(cut()));
connect(copyAction, SIGNAL(triggered()), this, SLOT(copy()));
connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste()));
connect(selectAllAction, SIGNAL(triggered()), this, SLOT(selectAll()));
connect(this, SIGNAL(undoAvailable(bool)), undoAction, SLOT(setEnabled(bool)));
connect(this, SIGNAL(redoAvailable(bool)), redoAction, SLOT(setEnabled(bool)));
connect(this, SIGNAL(copyAvailable(bool)), cutAction, SLOT(setEnabled(bool))); // OutputWindow never read-only
connect(this, SIGNAL(copyAvailable(bool)), copyAction, SLOT(setEnabled(bool)));
undoAction->setEnabled(false);
redoAction->setEnabled(false);
cutAction->setEnabled(false);
copyAction->setEnabled(false);
}
示例3: createDesignModeWidget
void BauhausPlugin::createDesignModeWidget()
{
Core::ICore *creatorCore = Core::ICore::instance();
Core::ActionManager *actionManager = creatorCore->actionManager();
m_editorManager = creatorCore->editorManager();
Core::ActionContainer *editMenu = actionManager->actionContainer(Core::Constants::M_EDIT);
m_mainWidget = new DesignModeWidget;
m_context = new DesignModeContext(m_mainWidget);
creatorCore->addContextObject(m_context);
Core::Context qmlDesignerMainContext(Constants::C_QMLDESIGNER);
Core::Context qmlDesignerFormEditorContext(Constants::C_QMLFORMEDITOR);
Core::Context qmlDesignerNavigatorContext(Constants::C_QMLNAVIGATOR);
// Revert to saved
actionManager->registerAction(m_revertToSavedAction,
Core::Constants::REVERTTOSAVED, qmlDesignerMainContext);
connect(m_revertToSavedAction, SIGNAL(triggered()), m_editorManager, SLOT(revertToSaved()));
//Save
actionManager->registerAction(m_saveAction, Core::Constants::SAVE, qmlDesignerMainContext);
connect(m_saveAction, SIGNAL(triggered()), m_editorManager, SLOT(saveFile()));
//Save As
actionManager->registerAction(m_saveAsAction, Core::Constants::SAVEAS, qmlDesignerMainContext);
connect(m_saveAsAction, SIGNAL(triggered()), m_editorManager, SLOT(saveFileAs()));
//Close Editor
actionManager->registerAction(m_closeCurrentEditorAction, Core::Constants::CLOSE, qmlDesignerMainContext);
connect(m_closeCurrentEditorAction, SIGNAL(triggered()), m_editorManager, SLOT(closeEditor()));
//Close All
actionManager->registerAction(m_closeAllEditorsAction, Core::Constants::CLOSEALL, qmlDesignerMainContext);
connect(m_closeAllEditorsAction, SIGNAL(triggered()), m_editorManager, SLOT(closeAllEditors()));
//Close All Others Action
actionManager->registerAction(m_closeOtherEditorsAction, Core::Constants::CLOSEOTHERS, qmlDesignerMainContext);
connect(m_closeOtherEditorsAction, SIGNAL(triggered()), m_editorManager, SLOT(closeOtherEditors()));
// Undo / Redo
actionManager->registerAction(m_mainWidget->undoAction(), Core::Constants::UNDO, qmlDesignerMainContext);
actionManager->registerAction(m_mainWidget->redoAction(), Core::Constants::REDO, qmlDesignerMainContext);
Core::Command *command;
//GoIntoComponent
command = actionManager->registerAction(m_mainWidget->goIntoComponentAction(),
Constants::GO_INTO_COMPONENT, qmlDesignerMainContext);
command->setDefaultKeySequence(QKeySequence(Qt::Key_F2));
//Edit Menu
command = actionManager->registerAction(m_mainWidget->deleteAction(),
QmlDesigner::Constants::DELETE, qmlDesignerFormEditorContext);
command = actionManager->registerAction(m_mainWidget->deleteAction(),
QmlDesigner::Constants::DELETE, qmlDesignerNavigatorContext);
command->setDefaultKeySequence(QKeySequence::Delete);
command->setAttribute(Core::Command::CA_Hide); // don't show delete in other modes
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
command = actionManager->registerAction(m_mainWidget->cutAction(),
Core::Constants::CUT, qmlDesignerFormEditorContext);
command = actionManager->registerAction(m_mainWidget->cutAction(),
Core::Constants::CUT, qmlDesignerNavigatorContext);
command->setDefaultKeySequence(QKeySequence::Cut);
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
command = actionManager->registerAction(m_mainWidget->copyAction(),
Core::Constants::COPY, qmlDesignerFormEditorContext);
command = actionManager->registerAction(m_mainWidget->copyAction(),
Core::Constants::COPY, qmlDesignerNavigatorContext);
command->setDefaultKeySequence(QKeySequence::Copy);
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
command = actionManager->registerAction(m_mainWidget->pasteAction(),
Core::Constants::PASTE, qmlDesignerFormEditorContext);
command = actionManager->registerAction(m_mainWidget->pasteAction(),
Core::Constants::PASTE, qmlDesignerNavigatorContext);
command->setDefaultKeySequence(QKeySequence::Paste);
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
command = actionManager->registerAction(m_mainWidget->selectAllAction(),
Core::Constants::SELECTALL, qmlDesignerFormEditorContext);
command = actionManager->registerAction(m_mainWidget->selectAllAction(),
Core::Constants::SELECTALL, qmlDesignerNavigatorContext);
command->setDefaultKeySequence(QKeySequence::SelectAll);
editMenu->addAction(command, Core::Constants::G_EDIT_SELECTALL);
Core::ActionContainer *viewsMenu = actionManager->actionContainer(Core::Constants::M_WINDOW_VIEWS);
command = actionManager->registerAction(m_mainWidget->toggleLeftSidebarAction(),
Constants::TOGGLE_LEFT_SIDEBAR, qmlDesignerMainContext);
command->setAttribute(Core::Command::CA_Hide);
command->setDefaultKeySequence(QKeySequence("Ctrl+Alt+0"));
viewsMenu->addAction(command);
command = actionManager->registerAction(m_mainWidget->toggleRightSidebarAction(),
Constants::TOGGLE_RIGHT_SIDEBAR, qmlDesignerMainContext);
//.........这里部分代码省略.........