summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppqtstyleindenter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/cpptools/cppqtstyleindenter.cpp')
-rw-r--r--src/plugins/cpptools/cppqtstyleindenter.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppqtstyleindenter.cpp b/src/plugins/cpptools/cppqtstyleindenter.cpp
index e1596c60c6..8877d5b49c 100644
--- a/src/plugins/cpptools/cppqtstyleindenter.cpp
+++ b/src/plugins/cpptools/cppqtstyleindenter.cpp
@@ -186,3 +186,21 @@ CppCodeStyleSettings CppQtStyleIndenter::codeStyleSettings() const
return m_cppCodeStylePreferences->currentCodeStyleSettings();
return CppCodeStyleSettings();
}
+
+TextEditor::IndentationForBlock
+CppQtStyleIndenter::indentationForBlocks(const QVector<QTextBlock> &blocks,
+ const TextEditor::TabSettings &tabSettings)
+{
+ QtStyleCodeFormatter codeFormatter(tabSettings, 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;
+}