TextEditor: Implement highlighting of function definitions

This allows users to style function names at their definitions.

Once set, the XML-style token "FunctionDefinition" will
highlight all function definitions: the style option is a
mixin to Function and Virtual Function.

TEST=Default themes and locally hacked themes that lack Function,
FunctionDefinition, Declaration-styling look as they did before
this patch.

Requires Clang.

Task-number: QTCREATORBUG-16625
Change-Id: I49d8e401211bdf28ff74699feac16fe98f6d64ce
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Hugo Holgersson
2016-07-17 00:29:33 +02:00
parent e050622f55
commit bf3c67e0d0
12 changed files with 85 additions and 14 deletions

View File

@@ -288,6 +288,8 @@ TextEditorSettings::TextEditorSettings(QObject *parent)
tr("Applied to lines describing changes in VCS log."),
Format(QColor(192, 0, 0), QColor()));
// Mixin categories
formatDescr.emplace_back(C_ERROR,
tr("Error"),
tr("Underline color of error diagnostics."),
@@ -312,14 +314,19 @@ TextEditorSettings::TextEditorSettings(QObject *parent)
QColor(255, 190, 0),
QTextCharFormat::DotLine,
FormatDescription::ShowUnderlineControl);
Format declarationFormat;
Format declarationFormat = Format::createMixinFormat();
declarationFormat.setBold(true);
formatDescr.emplace_back(C_DECLARATION,
tr("Function Declaration"),
tr("Style adjustments to function declarations."),
tr("Style adjustments to (function) declarations."),
declarationFormat,
FormatDescription::ShowFontUnderlineAndRelativeControls);
Format outputArgumentFormat;
formatDescr.emplace_back(C_FUNCTION_DEFINITION,
tr("Function Definition"),
tr("Name of function at its definition."),
Format::createMixinFormat(),
FormatDescription::ShowFontUnderlineAndRelativeControls);
Format outputArgumentFormat = Format::createMixinFormat();
outputArgumentFormat.setItalic(true);
formatDescr.emplace_back(C_OUTPUT_ARGUMENT,
tr("Output Argument"),