• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

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

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了EditorManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:pitservise,项目名称:ananas-creator,代码行数:7,代码来源:documenteditorplugin.cpp


示例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;
}
开发者ID:HiroyukiSeki,项目名称:qtplatz,代码行数:7,代码来源:sequenceeditorfactory.cpp


示例3: jumpToDefinition

void CppPlugin::jumpToDefinition()
{
    Core::EditorManager *em = Core::EditorManager::instance();
    CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget());
    if (editor)
        editor->jumpToDefinition();
}
开发者ID:NoobSaibot,项目名称:qtcreator-minimap,代码行数:7,代码来源:cppplugin.cpp


示例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;
}
开发者ID:CNOT,项目名称:julia-studio,代码行数:25,代码来源:qmljsoutline.cpp


示例5:

ITextEditor *LineNumberFilter::currentTextEditor() const
{
    Core::EditorManager *editorManager = Core::EditorManager::instance();
    if (!editorManager->currentEditor())
        return 0;
    return qobject_cast<TextEditor::ITextEditor*>(editorManager->currentEditor());
}
开发者ID:anchowee,项目名称:QtCreator,代码行数:7,代码来源:linenumberfilter.cpp


示例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 {
开发者ID:mornelon,项目名称:QtCreator_compliments,代码行数:31,代码来源:qmlengine.cpp


示例7: findUsages

void CppPlugin::findUsages()
{
    Core::EditorManager *em = Core::EditorManager::instance();
    CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget());
    if (editor)
        editor->findUsages();
}
开发者ID:NoobSaibot,项目名称:qtcreator-minimap,代码行数:7,代码来源:cppplugin.cpp


示例8: renameSymbolUnderCursor

void CppPlugin::renameSymbolUnderCursor()
{
    Core::EditorManager *em = Core::EditorManager::instance();
    CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget());
    if (editor)
        editor->renameSymbolUnderCursor();
}
开发者ID:NoobSaibot,项目名称:qtcreator-minimap,代码行数:7,代码来源:cppplugin.cpp


示例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());

}
开发者ID:TheProjecter,项目名称:project-qtcreator,代码行数:8,代码来源:qmljseditorplugin.cpp


示例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()));
}
开发者ID:stepanp,项目名称:qtcreator-tabbededitor-plugin,代码行数:58,代码来源:tabbar.cpp


示例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;
}
开发者ID:renatofilho,项目名称:QtCreator,代码行数:9,代码来源:genericprojectfileseditor.cpp


示例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;
    }
开发者ID:AtlantisCD9,项目名称:Qt,代码行数:10,代码来源:refactoringchanges.cpp


示例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();
    }
}
开发者ID:NoobSaibot,项目名称:qtcreator-minimap,代码行数:10,代码来源:cppplugin.cpp


示例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
}
开发者ID:halsten,项目名称:beaverdbg,代码行数:10,代码来源:vcsbaseeditor.cpp


示例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);
    }
}
开发者ID:anchowee,项目名称:QtCreator,代码行数:11,代码来源:linenumberfilter.cpp


示例16: quickFixNow

void CppPlugin::quickFixNow()
{
    if (! m_currentEditor)
        return;

    Core::EditorManager *em = Core::EditorManager::instance();
    CPPEditorWidget *currentEditor = qobject_cast<CPPEditorWidget*>(em->currentEditor()->widget());

    if (CPPEditorWidget *editor = qobject_cast<CPPEditorWidget*>(m_currentEditor->widget())) {
        if (currentEditor == editor) {
            if (editor->isOutdated())
                m_quickFixTimer->start(QUICKFIX_INTERVAL);
            else
                TextEditor::CompletionSupport::instance()->
                    complete(m_currentEditor, TextEditor::QuickFixCompletion, true);
        }
    }
}
开发者ID:NoobSaibot,项目名称:qtcreator-minimap,代码行数:18,代码来源:cppplugin.cpp


示例17: saveSettings

void CoolScroll::Internal::CoolScrollPlugin::onSettingChanged()
{
    saveSettings();
    Core::EditorManager* em = Core::EditorManager::instance();

    QList<Core::IEditor*> editors = em->visibleEditors();
    QList<Core::IEditor*>::iterator it = editors.begin();
    // editors will update settings after next opening
    for( ; it != editors.end(); ++it)
    {
        CoolScrollBar* bar = getEditorScrollBar(*it);
        Q_ASSERT(bar);
        bar->markStateDirty();
    }
    // update current editor right now
    CoolScrollBar* bar = getEditorScrollBar(em->currentEditor());
    Q_ASSERT(bar);
    bar->fullUpdateSettings();
}
开发者ID:jsavuoja,项目名称:qt-creator-coolscroll-plugin,代码行数:19,代码来源:coolscrollplugin.cpp


示例18: gotoSourceLocation

void QmlProfilerTool::gotoSourceLocation(const QString &fileUrl, int lineNumber)
{
    if (lineNumber < 0 || fileUrl.isEmpty())
        return;

#if 0
    const QString fileName = QUrl(fileUrl).toLocalFile();
    const QString projectFileName = d->m_projectFinder.findFile(fileName);

    Core::EditorManager *editorManager = Core::EditorManager::instance();
    Core::IEditor *editor = editorManager->openEditor(projectFileName);
    TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor*>(editor);

    if (textEditor) {
        editorManager->addCurrentPositionToNavigationHistory();
        textEditor->gotoLine(lineNumber);
        textEditor->widget()->setFocus();
    }
#endif
}
开发者ID:steveire,项目名称:GammaRay,代码行数:20,代码来源:qmlprofilertool.cpp


示例19: updateTextCursor

void CppOutlineWidget::updateTextCursor(const QModelIndex &proxyIndex)
{
    QModelIndex index = m_proxyModel->mapToSource(proxyIndex);
    CPlusPlus::Symbol *symbol = m_model->symbolFromIndex(index);
    if (symbol) {
        m_blockCursorSync = true;

        if (debug)
            qDebug() << "CppOutline - moving cursor to" << symbol->line() << symbol->column() - 1;

        Core::EditorManager *editorManager = Core::EditorManager::instance();
        editorManager->cutForwardNavigationHistory();
        editorManager->addCurrentPositionToNavigationHistory();

        // line has to be 1 based, column 0 based!
        m_editor->gotoLine(symbol->line(), symbol->column() - 1);
        m_editor->setFocus();
        m_blockCursorSync = false;
    }
}
开发者ID:aizaimenghuangu,项目名称:QtTestor,代码行数:20,代码来源:cppoutline.cpp


示例20: accept

void BaseFileFilter::accept(Locator::FilterEntry selection) const
{
    Core::EditorManager *em = Core::EditorManager::instance();
    em->openEditor(selection.internalData.toString(), QString(), Core::EditorManager::ModeSwitch);
}
开发者ID:anchowee,项目名称:QtCreator,代码行数:5,代码来源:basefilefilter.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ core::Element类代码示例发布时间:2022-05-31
下一篇:
C++ core::Context类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap