本文整理汇总了C++中ktexteditor::Document::setHighlightingMode方法的典型用法代码示例。如果您正苦于以下问题:C++ Document::setHighlightingMode方法的具体用法?C++ Document::setHighlightingMode怎么用?C++ Document::setHighlightingMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ktexteditor::Document
的用法示例。
在下文中一共展示了Document::setHighlightingMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}