本文整理汇总了C++中Highlighter::configureFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ Highlighter::configureFormat方法的具体用法?C++ Highlighter::configureFormat怎么用?C++ Highlighter::configureFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Highlighter
的用法示例。
在下文中一共展示了Highlighter::configureFormat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setFontSettings
void JuliaEditorWidget::setFontSettings(const TextEditor::FontSettings &fs)
{
using namespace TextEditor;
using namespace TextEditor::Internal;
BaseTextEditorWidget::setFontSettings(fs);
if (baseTextDocument()->syntaxHighlighter()) {
Highlighter *highlighter = static_cast<Highlighter *>(baseTextDocument()->syntaxHighlighter());
highlighter->configureFormat(Highlighter::VisualWhitespace, fs.toTextCharFormat(C_VISUAL_WHITESPACE));
highlighter->configureFormat(Highlighter::Keyword, fs.toTextCharFormat(C_KEYWORD));
highlighter->configureFormat(Highlighter::DataType, fs.toTextCharFormat(C_TYPE));
highlighter->configureFormat(Highlighter::Comment, fs.toTextCharFormat(C_COMMENT));
// Using C_NUMBER for all kinds of numbers.
highlighter->configureFormat(Highlighter::Decimal, fs.toTextCharFormat(C_NUMBER));
highlighter->configureFormat(Highlighter::BaseN, fs.toTextCharFormat(C_NUMBER));
highlighter->configureFormat(Highlighter::Float, fs.toTextCharFormat(C_NUMBER));
// Using C_STRING for strings and chars.
highlighter->configureFormat(Highlighter::Char, fs.toTextCharFormat(C_STRING));
highlighter->configureFormat(Highlighter::String, fs.toTextCharFormat(C_STRING));
highlighter->rehighlight();
}
}
示例2: setColorStyle
void KateHighlighter::setColorStyle(TextEditor::SyntaxHighlighter *h,const ColorStyleScheme *scheme)
{
Highlighter *highlighter = static_cast<Highlighter*>(h);
if (!highlighter) {
return;
}
QTextCharFormat fmt_vw;
if (!setTextCharStyle(fmt_vw,"VisualWhitespace",scheme)) {
fmt_vw.setForeground(Qt::lightGray);
}
highlighter->configureFormat(Highlighter::VisualWhitespace, fmt_vw);
QTextCharFormat fmt_kw;
if (!setTextCharStyle(fmt_kw,"Keyword",scheme)) {
fmt_kw.setForeground(Qt::darkBlue);
fmt_kw.setFontWeight(QFont::Bold);
}
highlighter->configureFormat(Highlighter::Keyword, fmt_kw);
QTextCharFormat fmt_dt;
if (!setTextCharStyle(fmt_dt,"DataType",scheme)) {
fmt_dt.setForeground(Qt::darkBlue);//Qt::darkMagenta);
}
highlighter->configureFormat(Highlighter::DataType, fmt_dt);
QTextCharFormat fmt_fn;
if (!setTextCharStyle(fmt_fn,"Function",scheme)) {
fmt_fn.setForeground(Qt::blue);
}
highlighter->configureFormat(Highlighter::Function,fmt_fn);
QTextCharFormat fmt_cmn;
if (!setTextCharStyle(fmt_cmn,"Comment",scheme)) {
fmt_cmn.setForeground(Qt::darkGreen);
}
highlighter->configureFormat(Highlighter::Comment, fmt_cmn);
QTextCharFormat fmt_dd;
if (!setTextCharStyle(fmt_dd,"Decimal",scheme)) {
fmt_dd.setForeground(Qt::darkMagenta);
}
// Using C_NUMBER for all kinds of numbers.
highlighter->configureFormat(Highlighter::Decimal, fmt_dd);
QTextCharFormat fmt_db;
if (!setTextCharStyle(fmt_db,"BaseN",scheme)) {
fmt_db.setForeground(Qt::darkMagenta);
}
highlighter->configureFormat(Highlighter::BaseN, fmt_db);
QTextCharFormat fmt_df;
if (!setTextCharStyle(fmt_df,"Float",scheme)) {
fmt_df.setForeground(Qt::darkMagenta);
}
highlighter->configureFormat(Highlighter::Float, fmt_df);
QTextCharFormat fmt_ch;
if (!setTextCharStyle(fmt_ch,"Char",scheme)) {
fmt_ch.setForeground(Qt::darkGreen);
}
// Using C_STRING for strings and chars.
highlighter->configureFormat(Highlighter::Char, fmt_ch);
QTextCharFormat fmt_cs;
if (!setTextCharStyle(fmt_cs,"String",scheme)) {
fmt_cs.setForeground(Qt::darkGreen);
}
highlighter->configureFormat(Highlighter::String, fmt_cs);
QTextCharFormat fmt_rm;
if (!setTextCharStyle(fmt_rm,"RegionMarker",scheme)) {
fmt_rm.setForeground(Qt::yellow);
}
highlighter->configureFormat(Highlighter::RegionMarker,fmt_rm);
QTextCharFormat fmt_alert;
if (!setTextCharStyle(fmt_alert,"Alert",scheme)) {
fmt_alert.setForeground(Qt::red);
}
highlighter->configureFormat(Highlighter::Alert,fmt_alert);
QTextCharFormat fmt_err;
if (!setTextCharStyle(fmt_err,"Error",scheme)) {
fmt_err.setForeground(Qt::red);
}
highlighter->configureFormat(Highlighter::Error,fmt_err);
QTextCharFormat fmt_sym;
if (!setTextCharStyle(fmt_sym,"Symbol",scheme)) {
fmt_sym.setForeground(Qt::red);
}
highlighter->configureFormat(Highlighter::Symbol,fmt_sym);
QTextCharFormat fmt_bf;
if (!setTextCharStyle(fmt_bf,"BuiltinFunc",scheme)) {
fmt_bf.setForeground(Qt::blue);
}
highlighter->configureFormat(Highlighter::BuiltinFunc,fmt_bf);
//.........这里部分代码省略.........