diff options
author | David Schulz <david.schulz@digia.com> | 2013-08-07 10:19:24 +0200 |
---|---|---|
committer | David Schulz <david.schulz@digia.com> | 2013-08-12 14:16:59 +0200 |
commit | 9d3f12f24f9e02102a0c4e166f7b6f2885d08580 (patch) | |
tree | 4e868274e8fa640224b1e8fc9035ed075bdb91af /src/plugins/projectexplorer/projectfilewizardextension.cpp | |
parent | 9e10b0536648ccf1bef25a02c770b47f3eb7f1c9 (diff) | |
download | qt-creator-9d3f12f24f9e02102a0c4e166f7b6f2885d08580.tar.gz |
Editor: Remove trailing whitespaces in generated files.
Task-number: QTCREATORBUG-9833
Change-Id: I7440d1e7c8ef303db1b6abfa8cd12325b934b0d2
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@digia.com>
Diffstat (limited to 'src/plugins/projectexplorer/projectfilewizardextension.cpp')
-rw-r--r-- | src/plugins/projectexplorer/projectfilewizardextension.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/plugins/projectexplorer/projectfilewizardextension.cpp b/src/plugins/projectexplorer/projectfilewizardextension.cpp index dca5a2c688..3b7671d7ab 100644 --- a/src/plugins/projectexplorer/projectfilewizardextension.cpp +++ b/src/plugins/projectexplorer/projectfilewizardextension.cpp @@ -48,6 +48,7 @@ #include <texteditor/icodestylepreferencesfactory.h> #include <texteditor/normalindenter.h> #include <texteditor/tabsettings.h> +#include <texteditor/storagesettings.h> #include <projectexplorer/project.h> #include <projectexplorer/editorconfiguration.h> @@ -580,13 +581,19 @@ void ProjectFileWizardExtension::applyCodeStyle(Core::GeneratedFile *file) const TextEditor::ICodeStylePreferences *codeStylePrefs = codeStylePreferences(baseProject, languageId); indenter->setCodeStylePreferences(codeStylePrefs); - QTextDocument doc(file->contents()); QTextCursor cursor(&doc); cursor.select(QTextCursor::Document); indenter->indent(&doc, cursor, QChar::Null, codeStylePrefs->currentTabSettings()); - file->setContents(doc.toPlainText()); delete indenter; + if (TextEditor::TextEditorSettings::instance()->storageSettings().m_cleanWhitespace) { + QTextBlock block = doc.firstBlock(); + while (block.isValid()) { + codeStylePrefs->currentTabSettings().removeTrailingWhitespace(cursor, block); + block = block.next(); + } + } + file->setContents(doc.toPlainText()); } QStringList ProjectFileWizardExtension::getProjectChoices() const |