diff --git a/doc/qtcreator/images/qtcreator-code-style-built-in-indenter.webp b/doc/qtcreator/images/qtcreator-code-style-built-in-indenter.webp new file mode 100644 index 00000000000..f8eaa1dac52 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-code-style-built-in-indenter.webp differ diff --git a/doc/qtcreator/images/qtcreator-code-style-clang-format-global.webp b/doc/qtcreator/images/qtcreator-code-style-clang-format-global.webp index c012f83ce9a..ddfc428e8c4 100644 Binary files a/doc/qtcreator/images/qtcreator-code-style-clang-format-global.webp and b/doc/qtcreator/images/qtcreator-code-style-clang-format-global.webp differ diff --git a/doc/qtcreator/images/qtcreator-code-style-clang-format-project.webp b/doc/qtcreator/images/qtcreator-code-style-clang-format-project.webp index dc4aefecd15..5c210034ec8 100644 Binary files a/doc/qtcreator/images/qtcreator-code-style-clang-format-project.webp and b/doc/qtcreator/images/qtcreator-code-style-clang-format-project.webp differ diff --git a/doc/qtcreator/images/qtcreator-code-style-settings-edit-qtquick.png b/doc/qtcreator/images/qtcreator-code-style-settings-edit-qtquick.png deleted file mode 100644 index 34473e4bd89..00000000000 Binary files a/doc/qtcreator/images/qtcreator-code-style-settings-edit-qtquick.png and /dev/null differ diff --git a/doc/qtcreator/images/qtcreator-options-code-style-qml.png b/doc/qtcreator/images/qtcreator-options-code-style-qml.png deleted file mode 100644 index 93bf1bdfb8b..00000000000 Binary files a/doc/qtcreator/images/qtcreator-options-code-style-qml.png and /dev/null differ diff --git a/doc/qtcreator/images/qtcreator-preferences-nim-code-style.webp b/doc/qtcreator/images/qtcreator-preferences-nim-code-style.webp index d6937200c4e..8fa9bb08376 100644 Binary files a/doc/qtcreator/images/qtcreator-preferences-nim-code-style.webp and b/doc/qtcreator/images/qtcreator-preferences-nim-code-style.webp differ diff --git a/doc/qtcreator/images/qtcreator-preferences-qtquick-code-style.webp b/doc/qtcreator/images/qtcreator-preferences-qtquick-code-style.webp new file mode 100644 index 00000000000..574f30dd64d Binary files /dev/null and b/doc/qtcreator/images/qtcreator-preferences-qtquick-code-style.webp differ diff --git a/doc/qtcreator/src/editors/creator-only/creator-preferences-cpp-code-style.qdoc b/doc/qtcreator/src/editors/creator-only/creator-preferences-cpp-code-style.qdoc index 44622426af8..56e413b7e93 100644 --- a/doc/qtcreator/src/editors/creator-only/creator-preferences-cpp-code-style.qdoc +++ b/doc/qtcreator/src/editors/creator-only/creator-preferences-cpp-code-style.qdoc @@ -1,4 +1,4 @@ -// Copyright (C) 2023 The Qt Company Ltd. +// Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! @@ -18,30 +18,39 @@ To specify global indentation settings for the C++ editor: \list 1 - \li Select \preferences > \uicontrol {C++}. + \li Go to \preferences > \uicontrol {C++}. \image qtcreator-code-style-clang-format-global.webp {Code Style preferences} \li In \uicontrol {Formatting mode}, select: \list \li \uicontrol {Indenting Only} to only indent code. \li \uicontrol {Full Formatting} to use the \key {Ctrl+I} keyboard shortcut to format code instead of indenting. - \li \uicontrol Disable to turn off ClangFormat. + \li \uicontrol {Use Built-In Indenter} to turn off ClangFormat. \endlist + \li Select \uicontrol {Ignore files greater than} to make parsing faster + by ignoring big files. Specify the maximum size of files to parse. \li To apply the formatting while you type, select \uicontrol {Format while typing}. \li To apply the formatting to the edited code when you save the file, select \uicontrol {Format edited code on file save}. \li To change the ClangFormat style globally for all projects, - select \uicontrol {Override ClangFormat configuration file}. - \li In the \uicontrol {Current settings} field, select the settings to - modify and click \uicontrol Copy. - \li Give a name to the settings and click \uicontrol OK. - \li Click \uicontrol Edit to set + select \uicontrol {Use custom settings}. + \li In \uicontrol {Custom settings}, select the settings to change, and + then select \uicontrol Copy. + \li Give a name to the settings, and select \uicontrol OK. + \li In \uicontrol ClangFormat, edit the \l{https://clang.llvm.org/docs/ClangFormatStyleOptions.html} - {ClangFormat Style Options}. + {ClangFormat Style Options}. The live preview shows how the + preferences change the indentation. + If you enter invalid values, you see warning messages. \endlist - In the other tabs, you can specify how to: + \section1 Using Built-In Indenter + + \image qtcreator-code-style-built-in-indenter.webp {Code Style preferences for built-in indenter} + + If you select \uicontrol {Use Built-In Indenter} in + \uicontrol {Formatting mode}, you can specify how to: \list \li Interpret the \key Tab and \key Backspace key presses. @@ -52,12 +61,9 @@ \li Bind pointers (*) and references (&) in types and declarations to identifiers, type names, or left or right \c const or \c volatile keywords. - \li Name getter functions. \endlist - Use the live preview to see how the preferences change the indentation. - - \section1 Specifying Settings for Content + \section2 Specifying Settings for Content You can indent public, protected, and private statements and declarations related to them within classes. @@ -67,24 +73,24 @@ \image qtcreator-code-style-content.png {Content preferences} - \section1 Specifying Settings for Braces + \section2 Specifying Settings for Braces You can indent class, namespace, enum and function declarations and code blocks. \image qtcreator-code-style-braces.png {Braces preferences} - \section1 Specifying Settings for Switch Statements + \section2 Specifying Settings for Switch Statements You can indent case or default statements, or statements or blocks related to them within switch statements. \image qtcreator-code-style-switch.png {Switch preferences} - \section1 Specifying Alignment + \section2 Specifying Alignment To align continuation lines to tokens after assignments, such as \c = or - \c +=, select the \uicontrol {Align after assignments} check box. You can + \c +=, select \uicontrol {Align after assignments}. You can specify additional settings for aligning continuation lines in the \uicontrol General tab. @@ -94,7 +100,7 @@ \image qtcreator-code-style-alignment.png {Alignment preferences} - \section1 Binding Pointers and References + \section2 Binding Pointers and References To bind pointers (\c *) and references (\c &) in types and declarations to identifiers, type names, or left or right \c const or \c volatile keywords, @@ -105,15 +111,6 @@ \image qtcreator-pointers-references.png {Pointers and References preferences} - \section1 Creating Project-Specific ClangFormat Files - - To override the \c {.clang-format} file for a particular project, create a - copy of the built-in style and edit its settings by selecting - \uicontrol Projects > \uicontrol {Project Settings} > - \uicontrol {Code Style} > \uicontrol Copy > \uicontrol Edit > - \uicontrol {ClangFormat} > - \uicontrol {Override ClangFormat configuration file}. - \section1 Creating ClangFormat Files from Command Line You can create \c {.clang-format} files that have the configuration @@ -124,5 +121,6 @@ clang-format -style=llvm -dump-config > .clang-format \endcode - \sa {Indent text or code}, {Behavior}, {Qt Quick Code Style}, {Nim} + \sa {Indent text or code}, {Specify code style}, {Behavior}, + {Qt Quick Code Style}, {Nim} */ diff --git a/doc/qtcreator/src/editors/creator-only/creator-preferences-nim.qdoc b/doc/qtcreator/src/editors/creator-only/creator-preferences-nim.qdoc index fa84ef87ca7..b5a62ae20c4 100644 --- a/doc/qtcreator/src/editors/creator-only/creator-preferences-nim.qdoc +++ b/doc/qtcreator/src/editors/creator-only/creator-preferences-nim.qdoc @@ -16,11 +16,11 @@ To specify preferences for the Nim editor (experimental): \list 1 - \li Select \preferences > \uicontrol Nim. - \li In the \uicontrol {Current settings} field, select the settings to - modify and click \uicontrol Copy. + \li Go to \preferences > \uicontrol Nim. + \li In \uicontrol {Custom settings}, select the settings to + modify, and then select \uicontrol Copy. \image qtcreator-preferences-nim-code-style.webp {Nim Code Style preferences} - \li Give a name to the settings and click \uicontrol OK. + \li Give a name to the settings, and select \uicontrol OK. \li Specify how to interpret the \key Tab key presses and how to align continuation lines. \li Select \uicontrol OK to save the settings. @@ -36,7 +36,7 @@ completion. To use Nimsuggest, you must install it on the development PC and enter the - path to the tool executable in the \uicontrol Path field. + path to the tool executable in \uicontrol Path. \image qtcreator-preferences-nim-tools.webp diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-settings-code-style.qdoc b/doc/qtcreator/src/projects/creator-only/creator-projects-settings-code-style.qdoc index e60d5c49c52..88e0354aaa9 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-settings-code-style.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-settings-code-style.qdoc @@ -1,4 +1,4 @@ -// Copyright (C) 2023 The Qt Company Ltd. +// Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only // ********************************************************************** @@ -19,16 +19,15 @@ and editor the file opens in. \QC opens C++ files in \uicontrol Edit mode in the C++ code editor and QML files in the Qt Quick editor. - You can specify indentation for: + Specify indentation for: \list \li C++ files \li QML files \li Nim files - \li Other text files \endlist - You can specify code style either globally or separately for each project. + Specify code style either globally or separately for each project. You can specify several sets of code style settings and easily switch between them. In addition, you can import and export code style settings. @@ -36,31 +35,30 @@ \list 1 - \li Select \uicontrol Projects > \uicontrol {Project Settings} > + \li Go to \uicontrol Projects > \uicontrol {Project Settings} > \uicontrol {Code Style}. \image qtcreator-code-style-clang-format-project.webp {Code Style settings in Projects mode} - \li In the \uicontrol Language field, select \uicontrol C++, + \li In \uicontrol Language, select \uicontrol C++, \uicontrol {Qt Quick}, or \uicontrol Nim. - \li Deselect the \uicontrol {Use global settings} check box. + \li For C++, clear \uicontrol {Use global settings} to use the + \c {.clang-format} file for the project. - \li In the \uicontrol {Current settings} field, select the settings to modify - and click \uicontrol Copy. - - \li Give a name to the settings and click \uicontrol OK. - - \li Click \uicontrol Edit to specify a code style for the project. + \li To override the project's \c {.clang-format} file, + select \uicontrol {Use custom settings}. + \li In \uicontrol {Custom settings}, select the settings to use for the + project. \endlist In rare cases, ClangFormat can trip over a code construct and trigger a \QC crash. If that happens for your project, select - \uicontrol Disable as the formatting mode to switch - ClangFormat off for the project. If you can reproduce the crash, - please select \uicontrol Help > \uicontrol {Report Bug} to report - the bug and and attach the code that triggers the crash. + \uicontrol {Use Built-In Indenter} in \uicontrol {Formatting mode} to + turn off ClangFormat for the project. If you can reproduce the crash, + go to \uicontrol Help > \uicontrol {Report Bug} to report + the bug and attach the code that triggers the crash to the bug report. \sa {Indent text or code}, {Edit MIME types}, {C++ Code Style}, {Qt Quick Code Style}, {Nim} diff --git a/doc/qtcreator/src/qtquick/creator-preferences-qtquick-code-style.qdoc b/doc/qtcreator/src/qtquick/creator-preferences-qtquick-code-style.qdoc index 6ea13251620..70655b99edd 100644 --- a/doc/qtcreator/src/qtquick/creator-preferences-qtquick-code-style.qdoc +++ b/doc/qtcreator/src/qtquick/creator-preferences-qtquick-code-style.qdoc @@ -19,21 +19,17 @@ To specify QML code style globally: \list 1 - \li Select \preferences > \uicontrol {Qt Quick}. - \li In the \uicontrol {Current settings} field, select the settings to - modify and click \uicontrol Copy. - \image qtcreator-options-code-style-qml.png {QML Code Style preferences} - \li Give a name to the settings and click \uicontrol OK. - \li Click \uicontrol Edit to specify code style settings for the project. - \image qtcreator-code-style-settings-edit-qtquick.png {Edit Code Style dialog} + \li Go to \preferences > \uicontrol {Qt Quick} > \uicontrol {Code Style}. + \li In \uicontrol {Custom settings}, select the settings to + modify, and then select \uicontrol Copy. + \image qtcreator-preferences-qtquick-code-style.webp {Qt Quick Code Style preferences} + \li Give a name to the settings, and select \uicontrol OK. + \li Specify how to interpret the \key Tab key presses and how to align + continuation lines. + \li In \uicontrol {Line length}, set the maximum line length for + code lines. \endlist - You can specify how to interpret the \key Tab key presses and how to align - continuation lines. - - In \uicontrol {Line length}, you can adjust the maximum line length for - code lines. - To override the global preferences for a particular project, select \uicontrol Projects > \uicontrol {Code Style}.