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

C++ ktexteditor::View类代码示例

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

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



在下文中一共展示了View类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: cursorContextDeclaration

///The first definition that belongs to a context that surrounds the current cursor
Declaration* cursorContextDeclaration() {
  KTextEditor::View* view = ICore::self()->documentController()->activeTextDocumentView();
  if(!view)
    return nullptr;

  KDevelop::DUChainReadLocker lock( DUChain::lock() );

  TopDUContext* ctx = DUChainUtils::standardContextForUrl(view->document()->url());
  if(!ctx)
    return nullptr;

  KTextEditor::Cursor cursor(view->cursorPosition());

  DUContext* subCtx = ctx->findContext(ctx->transformToLocalRevision(cursor));

  while(subCtx && !subCtx->owner())
    subCtx = subCtx->parentContext();

  Declaration* definition = nullptr;

  if(!subCtx || !subCtx->owner())
    definition = DUChainUtils::declarationInLine(cursor, ctx);
  else
    definition = subCtx->owner();

  if(!definition)
    return nullptr;

  return definition;
}
开发者ID:KDE,项目名称:kdevplatform,代码行数:31,代码来源:quickopenplugin.cpp


示例2: createView

KTextEditor::View* HtmlEditor::createView( QWidget* parent )
{
    KTextEditor::Document *document = mEditor->createDocument( parent );
    bool result = document->setHighlightingMode( "html" );
    if ( result ) {
        kDebug() << "Syntax highlighting enabled";
    }
    KTextEditor::View *view = document->createView( parent );
    QMenu *menu = view->defaultContextMenu();

    KTextEditor::ConfigInterface *interface = qobject_cast< KTextEditor::ConfigInterface* >( view );

    if ( interface ) {
        KAction *actWordWrap = new KAction( i18n( "Dynamic Word Wrap" ), view );
        actWordWrap->setCheckable( true );
        connect( actWordWrap, SIGNAL(triggered(bool)), this, SLOT(toggleWordWrap()) );

        KAction *actLineNumber = new KAction( i18n("Show line numbers"), view );
        actLineNumber->setCheckable( true );
        connect( actLineNumber, SIGNAL(triggered(bool)), this, SLOT(toggleLineNumber()) );

        QMenu *options = new QMenu( i18n( "Options" ), qobject_cast< QWidget* >( view ) );
        options->addAction( actWordWrap );
        options->addAction( actLineNumber );

        menu->addSeparator();
        menu->addMenu( options );
        
        interface->setConfigValue( "dynamic-word-wrap", true );
        actWordWrap->setChecked( true );
    }
    view->setContextMenu( menu );
    return view;
}
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:34,代码来源:htmleditor.cpp


示例3: sync

	void Konsole::sync()
	{
		if(!KileConfig::syncConsoleDirWithTabs()) {
			return;
		}

		KTextEditor::Document *doc = m_ki->activeTextDocument();
		KTextEditor::View *view = Q_NULLPTR;

		if(doc) {
			view = doc->views().first();
		}

		if(view) {
			QString finame;
			QUrl url = view->document()->url();

			if(url.path().isEmpty()) {
				return;
			}

			QFileInfo fic(url.adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash).path());
			if(fic.isReadable()) {
				setDirectory(url.adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash).path());
			}
		}
	}
开发者ID:KDE,项目名称:kile,代码行数:27,代码来源:konsolewidget.cpp


示例4: createView

bool KateViewManager::createView ( KTextEditor::Document *doc )
{
  if (m_blockViewCreationAndActivation) return false;

  // create doc
  if (!doc)
    doc = KateDocManager::self()->createDoc ();

  // create view, registers its XML gui itself
  KTextEditor::View *view = (KTextEditor::View *) doc->createView (activeViewSpace()->stack);

  m_viewList.append (view);
  m_activeStates[view] = false;

  // disable settings dialog action
  delete view->actionCollection()->action( "set_confdlg" );
  delete view->actionCollection()->action( "editor_options" );

  //view->setContextMenu(view->defaultContextMenu());

  connect(view, SIGNAL(dropEventPass(QDropEvent *)), mainWindow(), SLOT(slotDropEvent(QDropEvent *)));
  connect(view, SIGNAL(focusIn(KTextEditor::View *)), this, SLOT(activateSpace(KTextEditor::View *)));

  activeViewSpace()->addView( view );

  viewCreated(view);

  activateView( view );

  return true;
}
开发者ID:rtaycher,项目名称:kate,代码行数:31,代码来源:kateviewmanager.cpp


示例5: cursorDeclaration

Declaration* cursorDeclaration() {

  KTextEditor::View* view = ICore::self()->documentController()->activeTextDocumentView();
  if(!view)
    return nullptr;

  KDevelop::DUChainReadLocker lock( DUChain::lock() );

  return DUChainUtils::declarationForDefinition( DUChainUtils::itemUnderCursor( view->document()->url(), KTextEditor::Cursor(view->cursorPosition()) ).declaration );
}
开发者ID:KDE,项目名称:kdevplatform,代码行数:10,代码来源:quickopenplugin.cpp


示例6: QWidget

TextEditor::TextEditor(KTextEditor::Document *editorPart, PackageModel *model, QWidget *parent)
        : QWidget(parent)
{
    QHBoxLayout *l = new QHBoxLayout(this);

    QWidget *centralWidget = editorPart->widget();
    KTextEditor::View *view = qobject_cast<KTextEditor::View*>(centralWidget);
    if (view) {
        view->setContextMenu(view->defaultContextMenu());

        //modify the toolbar
        modifyToolBar(view);

        KTextEditor::ConfigInterface *config = qobject_cast<KTextEditor::ConfigInterface*>(view);
        if (config) {
            config->setConfigValue("line-numbers", true);
            config->setConfigValue("dynamic-word-wrap", true);
        }

        config = dynamic_cast<KTextEditor::ConfigInterface*>(editorPart);
        if (config) {
            config->setConfigValue("backup-on-save-prefix", ".");
        }

        // set nice defaults for katepart
        KTextEditor::CommandInterface *command = dynamic_cast<KTextEditor::CommandInterface *>(editorPart->editor());
        QString ret;
        if (command) { //generic
            command->queryCommand("set-indent-mode")->exec(view, "set-indent-mode normal", ret); // more friendly
            command->queryCommand("set-replace-tabs")->exec(view, "set-replace-tabs 1", ret);// replaces tabs with spaces????
            command->queryCommand("set-indent-width")->exec(view, "set-indent-width 4", ret);//4 spaces, Plasma's general coding style
        }

        //we should be setting the specific editing indentation, highlighting based on the type of document
        if (model->implementationApi() == "declarativeappletscript" || model->implementationApi() == "javascript") {
            editorPart->setHighlightingMode("JavaScript");
        } else if (model->implementationApi() == "ruby-script") {
            editorPart->setHighlightingMode("ruby");
            if (command) {
                command->queryCommand("set-indent-width")->exec(view, "set-indent-width 2", ret);// 2 spaces recommended for ruby
            }
        }
        //there is no need for one more control. But we keep the code because it is easier to understand.
        //so keep the generic format.
        /*} else if (editorPart->setHighlightingMode() == "python") {
            continue;
            // Q: why we don't change the spaces?
            // A: 4 spaces are recommended for python
        }*/

    }

    l->addWidget(centralWidget);
}
开发者ID:netrunner-debian-kde-extras,项目名称:plasmate,代码行数:54,代码来源:texteditor.cpp


示例7: docUrl

QUrl KateBuildView::docUrl()
{
    KTextEditor::View *kv = m_win->activeView();
    if (!kv) {
        qDebug() << "no KTextEditor::View" << endl;
        return QUrl();
    }

    if (kv->document()->isModified()) kv->document()->save();
    return kv->document()->url();
}
开发者ID:cmacq2,项目名称:kate,代码行数:11,代码来源:plugin_katebuild.cpp


示例8: createView

KTextEditor::View* TextInfo::createView(QWidget *parent, const char* /* name */)
{
	if(!m_doc) {
		return Q_NULLPTR;
	}
	KTextEditor::View *view = m_doc->createView(parent);
	installEventFilters(view);
	installSignalConnections(view);
	registerCodeCompletionModels(view);
	view->setStatusBarEnabled(false);
	connect(view, SIGNAL(destroyed(QObject*)), this, SLOT(slotViewDestroyed(QObject*)));
	return view;
}
开发者ID:KDE,项目名称:kile,代码行数:13,代码来源:documentinfo.cpp


示例9: displayBuildResult

void KateBuildView::displayBuildResult(const QString &msg, KTextEditor::Message::MessageType level)
{
    KTextEditor::View *kv = m_win->activeView();
    if (!kv) return;

    delete m_infoMessage;
    m_infoMessage = new KTextEditor::Message(xi18nc("@info", "<title>Make Results:</title><nl/>%1", msg), level);
    m_infoMessage->setWordWrap(true);
    m_infoMessage->setPosition(KTextEditor::Message::BottomInView);
    m_infoMessage->setAutoHide(5000);
    m_infoMessage->setAutoHideMode(KTextEditor::Message::Immediate);
    m_infoMessage->setView(kv);
    kv->document()->postMessage(m_infoMessage);
}
开发者ID:cmacq2,项目名称:kate,代码行数:14,代码来源:plugin_katebuild.cpp


示例10: slotDocChanged

void KatePluginSymbolViewerView::slotDocChanged()
{
 slotRefreshSymbol();

 KTextEditor::View *view = m_mainWindow->activeView();
 //qDebug()<<"Document changed !!!!" << view;
 if (view) {
   connect(view, SIGNAL(cursorPositionChanged(KTextEditor::View*,KTextEditor::Cursor)),
           this, SLOT(cursorPositionChanged()), Qt::UniqueConnection);

   if (view->document()) {
     connect(view->document(), SIGNAL(textChanged(KTextEditor::Document*)),
             this, SLOT(slotDocEdited()), Qt::UniqueConnection);
   }
 }
开发者ID:KDE,项目名称:kate,代码行数:15,代码来源:plugin_katesymbolviewer.cpp


示例11: lock

void KDevelop::DocumentationController::doShowDocumentation()
{
    IDocument* doc = ICore::self()->documentController()->activeDocument();
    if(!doc)
      return;
    
    KTextEditor::Document* textDoc = doc->textDocument();
    if(!textDoc)
      return;
    
    KTextEditor::View* view = textDoc->activeView();
    if(!view)
      return;
    
    KDevelop::DUChainReadLocker lock( DUChain::lock() );
    
    Declaration *dec = DUChainUtils::declarationForDefinition( DUChainUtils::itemUnderCursor( doc->url(), SimpleCursor(view->cursorPosition()) ) );
    
    if(dec) {
        KSharedPtr< IDocumentation > documentation = documentationForDeclaration(dec);
        if(documentation) {
            showDocumentation(documentation);
        }
    }
}
开发者ID:caidongyun,项目名称:kdevplatform,代码行数:25,代码来源:documentationcontroller.cpp


示例12: slotEditKeys

void MainWindow::slotEditKeys()
{
  KKeyDialog dlg;
  dlg.insert(actionCollection());

  if(m_tabEditor->count() != 0)
  {
    KTextEditor::View* view  = m_tabEditor->currentView();
    if(view)
    {
      dlg.insert(view->actionCollection());
    }
  }

  dlg.configure();
}
开发者ID:thiago-silva,项目名称:protoeditor,代码行数:16,代码来源:mainwindow.cpp


示例13: showView

bool KateViewSpace::showView(KTextEditor::Document *document)
{
    const int index = m_lruDocList.lastIndexOf(document);

    if (index < 0) {
        return false;
    }

    if (! m_docToView.contains(document)) {
        return false;
    }

    KTextEditor::View *kv = m_docToView[document];

    // move view to end of list
    m_lruDocList.removeAt(index);
    m_lruDocList.append(document);
    stack->setCurrentWidget(kv);
    kv->show();

    // in case a tab does not exist, add one
    if (! m_docToTabId.contains(document)) {
        // if space is available, add button
        if (m_tabBar->count() < m_tabBar->maxTabCount()) {
            // just insert
            insertTab(m_tabBar->count(), document);
        } else {
            // remove "oldest" button and replace with new one
            Q_ASSERT(m_lruDocList.size() > m_tabBar->count());

            // we need to subtract by 1 more, as we just added ourself to the end of the lru list!
            KTextEditor::Document * docToHide = m_lruDocList[m_lruDocList.size() - m_tabBar->maxTabCount() - 1];
            Q_ASSERT(m_docToTabId.contains(docToHide));
            const int insertIndex = removeTab(docToHide, false);

            // add new one at removed position
            insertTab(insertIndex, document);
        }
    }

    // follow current view
    Q_ASSERT(m_docToTabId.contains(document));
    m_tabBar->setCurrentTab(m_docToTabId.value(document, -1));

    return true;
}
开发者ID:cmacq2,项目名称:kate,代码行数:46,代码来源:kateviewspace.cpp


示例14: getCursorPos

// /home/follinge/projects/kscope-kde4/src/editorpage4.h:61:7: error: candidate is: bool kscope4::EditorPage::getCursorPos(uint&, uint&)
bool EditorPage::getCursorPos(int& nLine, int& nCol)
{
    KTextEditor::View* pCursorIf;

    // Acquire the view cursor
    pCursorIf = dynamic_cast<KTextEditor::View*>(m_pView);
    if (pCursorIf == NULL)
        return false;

    // Get the cursor position (adjusted to 1-based counting)
    //pCursorIf->cursorPosition(&nLine, &nCol);
    pCursorIf->cursorPosition().position(nLine, nCol);
    nLine++;
    nCol++;

    return true;
}
开发者ID:fredollinger,项目名称:kscope-kde4,代码行数:18,代码来源:editorpage4.cpp


示例15: slotClicked

void PluginKateXMLCheckView::slotClicked(QTreeWidgetItem *item, int column)
{
	Q_UNUSED(column);
	qDebug() << "slotClicked";
	if( item ) {
		bool ok = true;
		uint line = item->text(1).toUInt(&ok);
		bool ok2 = true;
		uint column = item->text(2).toUInt(&ok);
		if( ok && ok2 ) {
			KTextEditor::View *kv = m_mainWindow->activeView();
			if( ! kv )
				return;

			kv->setCursorPosition(KTextEditor::Cursor (line-1, column));
		}
	}
}
开发者ID:KDE,项目名称:kate,代码行数:18,代码来源:plugin_katexmlcheck.cpp


示例16: slipInFilter

static void slipInFilter(KProcess & proc, KTextEditor::View & view, QString command)
{
  QString inputText;

  if (view.selection()) {
    inputText = view.selectionText();
  }

  proc.clearProgram ();
  proc.setShellCommand(command);

  proc.start();
  QByteArray encoded = inputText.toLocal8Bit();
  proc.write(encoded);
  proc.closeWriteChannel();
  //  TODO: Put up a modal dialog to defend the text from further
  //  keystrokes while the command is out. With a cancel button...
}
开发者ID:benpope82,项目名称:kate,代码行数:18,代码来源:plugin_katetextfilter.cpp


示例17: run

void View::run()
{
  KTextEditor::View *view = mw->activeView();

  if (!view) {
    return;
  }
  if (m_global.saveBeforeRun) {
    view->document()->save();
  }

  KTextEditor::Document *doc = view->document();
  QString filename = doc->url().path();
  QString directory = doc->url().directory();

  kDebug() << filename << "-" << directory;
  QString cmd = txtCommand->text();
  cmd = cmd.replace("%filename", filename).replace("%directory", directory);
  execute(cmd);
}
开发者ID:hgrecco,项目名称:KateCodeinfo,代码行数:20,代码来源:kciview.cpp


示例18: cg

KTextEditor::View *KateViewSpace::createView(KTextEditor::Document *doc)
{
    // should only be called if a view does not yet exist
    Q_ASSERT(! m_docToView.contains(doc));

    /**
     * Create a fresh view
     */
    KTextEditor::View *v = doc->createView(stack, m_viewManager->mainWindow()->wrapper());

    // set status bar to right state
    v->setStatusBarEnabled(m_viewManager->mainWindow()->showStatusBar());

    // restore the config of this view if possible
    if (!m_group.isEmpty()) {
        QString fn = v->document()->url().toString();
        if (! fn.isEmpty()) {
            QString vgroup = QString::fromLatin1("%1 %2").arg(m_group).arg(fn);

            KateSession::Ptr as = KateApp::self()->sessionManager()->activeSession();
            if (as->config() && as->config()->hasGroup(vgroup)) {
                KConfigGroup cg(as->config(), vgroup);
                v->readSessionConfig(cg);
            }
        }
    }

    // register document, it is shown below through showView() then
    if (! m_lruDocList.contains(doc)) {
        registerDocument(doc);
        Q_ASSERT(m_lruDocList.contains(doc));
    }

    // insert View into stack
    stack->addWidget(v);
    m_docToView[doc] = v;
    showView(v);

    return v;
}
开发者ID:cmacq2,项目名称:kate,代码行数:40,代码来源:kateviewspace.cpp


示例19: slotDocumentOpen

void KateViewManager::slotDocumentOpen ()
{
  KTextEditor::View *cv = activeView();

  if (cv)
  {
    KEncodingFileDialog::Result r = KEncodingFileDialog::getOpenUrlsAndEncoding(
                                      KateDocManager::self()->editor()->defaultEncoding(),
                                      cv->document()->url().url(),
                                      QString(), m_mainWindow, i18n("Open File"));

    KateDocumentInfo docInfo;
    docInfo.openedByUser = true;

    KTextEditor::Document *lastID = 0;
    for (KUrl::List::Iterator i = r.URLs.begin(); i != r.URLs.end(); ++i)
      lastID = openUrl( *i, r.encoding, false, false, docInfo);

    if (lastID)
      activateView (lastID);
  }
}
开发者ID:rtaycher,项目名称:kate,代码行数:22,代码来源:kateviewmanager.cpp


示例20: specialObjectNavigationWidget

QWidget* QuickOpenPlugin::specialObjectNavigationWidget() const
{
  KTextEditor::View* view = ICore::self()->documentController()->activeTextDocumentView();
  if( !view )
    return nullptr;

  QUrl url = ICore::self()->documentController()->activeDocument()->url();

  const auto languages = ICore::self()->languageController()->languagesForUrl(url);
  foreach (const auto language, languages) {
    QWidget* w = language->specialLanguageObjectNavigationWidget(url, KTextEditor::Cursor(view->cursorPosition()) );
    if(w)
      return w;
  }
开发者ID:KDE,项目名称:kdevplatform,代码行数:14,代码来源:quickopenplugin.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ attribute::Ptr类代码示例发布时间:2022-05-31
下一篇:
C++ ktexteditor::Range类代码示例发布时间: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