diff options
author | Eike Ziller <eike.ziller@qt.io> | 2016-08-31 14:40:38 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2016-08-31 14:40:38 +0200 |
commit | c56aa52b8082bf39bd822f8d110f4a41757100f9 (patch) | |
tree | 22ee09ed89b75d1e08674f5836bb516c8f1ab048 /src/plugins/glsleditor | |
parent | a4bf137a9f0319c6f3b9ecc3345d1ab9520f128c (diff) | |
parent | 89ff2c1db5ee2068cf763ff1789b17b7f2afa118 (diff) |
Merge remote-tracking branch 'origin/4.1'
Conflicts:
qbs/modules/qtc/qtc.qbs
qtcreator.pri
src/plugins/qmakeprojectmanager/makestep.cpp
src/shared/qbs
Change-Id: If1787ed23afa786ed2cef57f53c1db642559cbe0
Diffstat (limited to 'src/plugins/glsleditor')
-rw-r--r-- | src/plugins/glsleditor/glslindenter.cpp | 19 | ||||
-rw-r--r-- | src/plugins/glsleditor/glslindenter.h | 2 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/plugins/glsleditor/glslindenter.cpp b/src/plugins/glsleditor/glslindenter.cpp index 33aa847064..3b229f0c90 100644 --- a/src/plugins/glsleditor/glslindenter.cpp +++ b/src/plugins/glsleditor/glslindenter.cpp @@ -124,5 +124,24 @@ int GlslIndenter::indentFor(const QTextBlock &block, const TextEditor::TabSettin return indent; } +TextEditor::IndentationForBlock +GlslIndenter::indentationForBlocks(const QVector<QTextBlock> &blocks, + const TextEditor::TabSettings &tabSettings) +{ + CppTools::QtStyleCodeFormatter codeFormatter(tabSettings, + CppTools::CppToolsSettings::instance()->cppCodeStyle()->codeStyleSettings()); + + codeFormatter.updateStateUntil(blocks.last()); + + TextEditor::IndentationForBlock ret; + foreach (QTextBlock block, blocks) { + int indent; + int padding; + codeFormatter.indentFor(block, &indent, &padding); + ret.insert(block.blockNumber(), indent); + } + return ret; +} + } // namespace Internal } // namespace GlslEditor diff --git a/src/plugins/glsleditor/glslindenter.h b/src/plugins/glsleditor/glslindenter.h index e52a024b10..42696f0d99 100644 --- a/src/plugins/glsleditor/glslindenter.h +++ b/src/plugins/glsleditor/glslindenter.h @@ -48,6 +48,8 @@ public: const TextEditor::TabSettings &tabSettings) override; int indentFor(const QTextBlock &block, const TextEditor::TabSettings &tabSettings) override; + TextEditor::IndentationForBlock indentationForBlocks(const QVector<QTextBlock> &blocks, + const TextEditor::TabSettings &tabSettings) override; }; } // namespace Internal |