aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorLeena Miettinen <riitta-leena.miettinen@qt.io>2018-10-16 16:45:49 +0200
committerLeena Miettinen <riitta-leena.miettinen@qt.io>2018-10-25 12:48:04 +0000
commitf61c8c680d672360254c2e88e62195d801ae6c3f (patch)
tree2fab35fe72b29b6bb8c5a26408543deaa1a331dd /doc
parent45ec0aea378484454cb5e81f327fca5cbc164560 (diff)
Doc: Describe the Clang Format plugin
Change-Id: I596af2775a4abb8e0331e1eb3de1b55cae0f15d7 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Diffstat (limited to 'doc')
-rw-r--r--doc/images/qtcreator-clang-format-options.pngbin0 -> 49932 bytes
-rw-r--r--doc/src/editors/creator-clangformat.qdocinc66
-rw-r--r--doc/src/editors/creator-code-indentation.qdoc2
3 files changed, 68 insertions, 0 deletions
diff --git a/doc/images/qtcreator-clang-format-options.png b/doc/images/qtcreator-clang-format-options.png
new file mode 100644
index 0000000000..cce8d09fa4
--- /dev/null
+++ b/doc/images/qtcreator-clang-format-options.png
Binary files differ
diff --git a/doc/src/editors/creator-clangformat.qdocinc b/doc/src/editors/creator-clangformat.qdocinc
new file mode 100644
index 0000000000..3ba9984f9f
--- /dev/null
+++ b/doc/src/editors/creator-clangformat.qdocinc
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Creator documentation.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+**
+****************************************************************************/
+
+/*!
+//! [clang format]
+
+ \section2 Automatic Indentation
+
+ The experimental Clang Format plugin uses the
+ \l{https://clang.llvm.org/docs/LibFormat.html}{LibFormat}
+ library for automatic indentation.
+
+ To enable the plugin, select \uicontrol Help > \uicontrol {About Plugins} >
+ \uicontrol {C++} > \uicontrol {ClangFormat}. Then restart \QC to load the
+ plugin.
+
+ To specify global settings for Clang Format:
+
+ \list 1
+ \li Select \uicontrol Tools > \uicontrol Options > \uicontrol {C++} >
+ \uicontrol {Clang Format}.
+ \image qtcreator-clang-format-options.png "C++ Clang Format options"
+ \li Double-click a value to modify it.
+ \endlist
+
+ You can also specify formatting separately for each project.
+ Create a \c {.clang-format} file that contains the
+ \l{https://clang.llvm.org/docs/ClangFormatStyleOptions.html}
+ {Clang Format Style Options} to use and save it in the project directory.
+
+ You can create \c {.clang-format} files that contain the configuration
+ options of a certain predefined style from the command line. For example,
+ to create a format file for the LLVM style, enter the following command:
+
+ \badcode
+ clang-format -style=llvm -dump-config > .clang-format
+ \endcode
+
+ To view the \c {.clang-format} file for a project, select
+ \uicontrol Projects > \uicontrol {Project Settings} >
+ \uicontrol {Clang Format}.
+
+//! [clang format]
+*/
diff --git a/doc/src/editors/creator-code-indentation.qdoc b/doc/src/editors/creator-code-indentation.qdoc
index 61d67f6750..c1427f460a 100644
--- a/doc/src/editors/creator-code-indentation.qdoc
+++ b/doc/src/editors/creator-code-indentation.qdoc
@@ -86,6 +86,8 @@
To specify different settings for a particular project, select
\uicontrol Projects > \uicontrol {Code Style Settings}.
+
+ \include creator-clangformat.qdocinc clang format
\endif
\section1 Indenting QML Files