本文整理汇总了C++中KateView::tabWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ KateView::tabWidth方法的具体用法?C++ KateView::tabWidth怎么用?C++ KateView::tabWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KateView
的用法示例。
在下文中一共展示了KateView::tabWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: args
//.........这里部分代码省略.........
bool ok;
int val ( args.first().toInt( &ok ) );
if ( !ok )
KCC_ERR( i18n("Failed to convert argument '%1' to integer.")
.arg( args.first() ) );
if ( cmd == "set-tab-width" )
{
if ( val < 1 )
KCC_ERR( i18n("Width must be at least 1.") );
v->setTabWidth( val );
}
else if ( cmd == "set-indent-width" )
{
if ( val < 1 )
KCC_ERR( i18n("Width must be at least 1.") );
v->doc()->config()->setIndentationWidth( val );
}
else if ( cmd == "set-word-wrap-column" )
{
if ( val < 2 )
KCC_ERR( i18n("Column must be at least 1.") );
v->doc()->setWordWrapAt( val );
}
else if ( cmd == "goto" )
{
if ( val < 1 )
KCC_ERR( i18n("Line must be at least 1") );
if ( (uint)val > v->doc()->numLines() )
KCC_ERR( i18n("There is not that many lines in this document") );
v->gotoLineNumber( val - 1 );
}
return true;
}
// ALL commands that takes 1 boolean argument.
else if ( cmd == "set-icon-border" ||
cmd == "set-folding-markers" ||
cmd == "set-line-numbers" ||
cmd == "set-replace-tabs" ||
cmd == "set-remove-trailing-space" ||
cmd == "set-show-tabs" ||
cmd == "set-indent-spaces" ||
cmd == "set-mixed-indent" ||
cmd == "set-word-wrap" ||
cmd == "set-wrap-cursor" ||
cmd == "set-replace-tabs-save" ||
cmd == "set-remove-trailing-space-save" ||
cmd == "set-show-indent" )
{
if ( ! args.count() )
KCC_ERR( i18n("Usage: %1 on|off|1|0|true|false").arg( cmd ) );
bool enable;
if ( getBoolArg( args.first(), &enable ) )
{
if ( cmd == "set-icon-border" )
v->setIconBorder( enable );
else if (cmd == "set-folding-markers")
v->setFoldingMarkersOn( enable );
else if ( cmd == "set-line-numbers" )
v->setLineNumbersOn( enable );
else if ( cmd == "set-show-indent" )
v->renderer()->setShowIndentLines( enable );
else if ( cmd == "set-replace-tabs" )
setDocFlag( KateDocumentConfig::cfReplaceTabsDyn, enable, v->doc() );
else if ( cmd == "set-remove-trailing-space" )
setDocFlag( KateDocumentConfig::cfRemoveTrailingDyn, enable, v->doc() );
else if ( cmd == "set-show-tabs" )
setDocFlag( KateDocumentConfig::cfShowTabs, enable, v->doc() );
else if ( cmd == "set-indent-spaces" )
setDocFlag( KateDocumentConfig::cfSpaceIndent, enable, v->doc() );
else if ( cmd == "set-mixed-indent" )
{
// this is special, in that everything is set up -- space-indent is enabled,
// and a indent-width is set if it is 0 (to tabwidth/2)
setDocFlag( KateDocumentConfig::cfMixedIndent, enable, v->doc() );
if ( enable )
{
setDocFlag( KateDocumentConfig::cfSpaceIndent, enable, v->doc() );
if ( ! v->doc()->config()->indentationWidth() )
v->doc()->config()->setIndentationWidth( v->tabWidth()/2 );
}
}
else if ( cmd == "set-word-wrap" )
v->doc()->setWordWrap( enable );
else if ( cmd == "set-remove-trailing-space-save" )
setDocFlag( KateDocumentConfig::cfRemoveSpaces, enable, v->doc() );
else if ( cmd == "set-wrap-cursor" )
setDocFlag( KateDocumentConfig::cfWrapCursor, enable, v->doc() );
return true;
}
else
KCC_ERR( i18n("Bad argument '%1'. Usage: %2 on|off|1|0|true|false")
.arg( args.first() ).arg( cmd ) );
}
// unlikely..
KCC_ERR( i18n("Unknown command '%1'").arg(cmd) );
}