本文整理汇总了C++中core::EditorManager类的典型用法代码示例。如果您正苦于以下问题:C++ EditorManager类的具体用法?C++ EditorManager怎么用?C++ EditorManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EditorManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: kind
Core::IFile *DocumentEditorFactory::open(const QString &fileName)
{
Core::EditorManager *em = Core::EditorManager::instance();
Core::IEditor *iface = em->openEditor(fileName, kind());
return iface ? iface->file() : 0;
}
示例2:
Core::IFile *
SequenceEditorFactory::open(const QString& filename )
{
Core::EditorManager * em = Core::EditorManager::instance();
Core::IEditor * iface = em->openEditor( filename, kind_ );
return iface ? iface->file() : 0;
}
示例3: jumpToDefinition
void CppPlugin::jumpToDefinition()
{
Core::EditorManager *em = Core::EditorManager::instance();
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget());
if (editor)
editor->jumpToDefinition();
}
示例4: updateTextCursor
void QmlJSOutlineWidget::updateTextCursor(const QModelIndex &index)
{
QModelIndex sourceIndex = m_filterModel->mapToSource(index);
AST::SourceLocation location = m_editor->outlineModel()->sourceLocation(sourceIndex);
if (!location.isValid())
return;
const QTextBlock lastBlock = m_editor->document()->lastBlock();
const uint textLength = lastBlock.position() + lastBlock.length();
if (location.offset >= textLength)
return;
Core::EditorManager *editorManager = Core::EditorManager::instance();
editorManager->cutForwardNavigationHistory();
editorManager->addCurrentPositionToNavigationHistory();
QTextCursor textCursor = m_editor->textCursor();
m_blockCursorSync = true;
textCursor.setPosition(location.offset);
m_editor->setTextCursor(textCursor);
m_editor->centerCursor();
m_editor->setFocus();
m_blockCursorSync = false;
}
示例5:
ITextEditor *LineNumberFilter::currentTextEditor() const
{
Core::EditorManager *editorManager = Core::EditorManager::instance();
if (!editorManager->currentEditor())
return 0;
return qobject_cast<TextEditor::ITextEditor*>(editorManager->currentEditor());
}
示例6: gotoLocation
void QmlEngine::gotoLocation(const Location &location)
{
const QString fileName = location.fileName();
// TODO: QUrl::isLocalFile() once we depend on Qt 4.8
if (QUrl(fileName).scheme().compare(QLatin1String("file"), Qt::CaseInsensitive) == 0) {
// internal file from source files -> show generated .js
QTC_ASSERT(m_sourceDocuments.contains(fileName), return);
Core::IEditor *editor = 0;
Core::EditorManager *editorManager = Core::EditorManager::instance();
QString titlePattern = tr("JS Source for %1").arg(fileName);
//Check if there are open editors with the same title
QList<Core::IEditor *> editors = editorManager->openedEditors();
foreach (Core::IEditor *ed, editors) {
if (ed->displayName() == titlePattern) {
editor = ed;
break;
}
}
if (!editor) {
editor = Core::EditorManager::openEditorWithContents(QmlJSEditor::Constants::C_QMLJSEDITOR_ID,
&titlePattern);
if (editor) {
editor->setProperty(Constants::OPENED_BY_DEBUGGER, true);
}
updateEditor(editor, m_sourceDocuments.value(fileName));
}
Core::EditorManager::activateEditor(editor);
} else {
示例7: findUsages
void CppPlugin::findUsages()
{
Core::EditorManager *em = Core::EditorManager::instance();
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget());
if (editor)
editor->findUsages();
}
示例8: renameSymbolUnderCursor
void CppPlugin::renameSymbolUnderCursor()
{
Core::EditorManager *em = Core::EditorManager::instance();
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget());
if (editor)
editor->renameSymbolUnderCursor();
}
示例9: openPreview
void QmlJSEditorPlugin::openPreview()
{
Core::EditorManager *em = Core::EditorManager::instance();
if (em->currentEditor() && em->currentEditor()->id() == Constants::C_QMLJSEDITOR_ID)
m_previewRunner->run(em->currentEditor()->file()->fileName());
}
示例10: sp
TabBar::TabBar(QWidget *parent) :
QTabBar(parent)
{
setExpanding(false);
setMovable(true);
setTabsClosable(true);
setUsesScrollButtons(true);
QSizePolicy sp(QSizePolicy::Preferred, QSizePolicy::Fixed);
sp.setHorizontalStretch(1);
sp.setVerticalStretch(0);
sp.setHeightForWidth(sizePolicy().hasHeightForWidth());
setSizePolicy(sp);
connect(this, &QTabBar::tabMoved, [this](int from, int to) {
m_editors.move(from, to);
});
Core::EditorManager *em = Core::EditorManager::instance();
connect(em, &Core::EditorManager::editorOpened, this, &TabBar::addEditorTab);
connect(em, &Core::EditorManager::editorsClosed, this, &TabBar::removeEditorTabs);
connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(selectEditorTab(Core::IEditor*)));
connect(this, &QTabBar::currentChanged, this, &TabBar::activateEditor);
connect(this, &QTabBar::tabCloseRequested, this, &TabBar::closeTab);
ProjectExplorer::SessionManager *sm = ProjectExplorer::SessionManager::instance();
connect(sm, &ProjectExplorer::SessionManager::sessionLoaded, [this, em]() {
foreach (Core::DocumentModel::Entry *entry, Core::DocumentModel::entries())
em->activateEditorForEntry(entry, Core::EditorManager::DoNotChangeCurrentEditor);
});
const QString shortCutSequence = QStringLiteral("Ctrl+Alt+%1");
for (int i = 1; i <= 10; ++i) {
QShortcut *shortcut = new QShortcut(shortCutSequence.arg(i % 10), this);
connect(shortcut, &QShortcut::activated, [this, shortcut]() {
setCurrentIndex(m_shortcuts.indexOf(shortcut));
});
m_shortcuts.append(shortcut);
}
QAction *prevTabAction = new QAction(tr("Switch to previous tab"), this);
Core::Command *prevTabCommand
= Core::ActionManager::registerAction(prevTabAction,
TabbedEditor::Constants::PREV_TAB_ID,
Core::Context(Core::Constants::C_GLOBAL));
prevTabCommand->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+J")));
connect(prevTabAction, SIGNAL(triggered()), this, SLOT(prevTabAction()));
QAction *nextTabAction = new QAction(tr("Switch to next tab"), this);
Core::Command *nextTabCommand
= Core::ActionManager::registerAction(nextTabAction,
TabbedEditor::Constants::NEXT_TAB_ID,
Core::Context(Core::Constants::C_GLOBAL));
nextTabCommand->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+K")));
connect(nextTabAction, SIGNAL(triggered()), this, SLOT(nextTabAction()));
}
示例11:
Core::IFile *ProjectFilesFactory::open(const QString &fileName)
{
Core::EditorManager *editorManager = Core::EditorManager::instance();
if (Core::IEditor *editor = editorManager->openEditor(fileName, id()))
return editor->file();
return 0;
}
示例12: foreach
BaseTextEditorWidget *RefactoringChanges::editorForFile(const QString &fileName)
{
Core::EditorManager *editorManager = Core::EditorManager::instance();
const QList<Core::IEditor *> editors = editorManager->editorsForFileName(fileName);
foreach (Core::IEditor *editor, editors) {
BaseTextEditorWidget *textEditor = qobject_cast<BaseTextEditorWidget *>(editor->widget());
if (textEditor != 0)
return textEditor;
}
示例13: openTypeHierarchy
void CppPlugin::openTypeHierarchy()
{
Core::EditorManager *em = Core::EditorManager::instance();
CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget());
if (editor) {
Core::NavigationWidget *navigation = Core::NavigationWidget::instance();
navigation->activateSubWidget(QLatin1String(Constants::TYPE_HIERARCHY_ID));
emit typeHierarchyRequested();
}
}
示例14: slotDiffBrowse
void VCSBaseEditor::slotDiffBrowse(int index)
{
// goto diffed file as indicated by index/line number
if (index < 0 || index >= d->m_diffSections.size())
return;
const int lineNumber = d->m_diffSections.at(index);
Core::EditorManager *editorManager = Core::EditorManager::instance();
editorManager->addCurrentPositionToNavigationHistory();
gotoLine(lineNumber + 1, 0); // TextEdit uses 1..n convention
}
示例15: accept
void LineNumberFilter::accept(FilterEntry selection) const
{
ITextEditor *editor = currentTextEditor();
if (editor) {
Core::EditorManager *editorManager = Core::EditorManager::instance();
editorManager->addCurrentPositionToNavigationHistory();
editor->gotoLine(selection.internalData.toInt());
editor->widget()->setFocus();
Core::ModeManager::instance()->activateModeType(Core::Constants::MODE_EDIT_TYPE);
}
}