// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

// **********************************************************************
// NOTE: the sections are not ordered by their logical order to avoid
// reshuffling the file each time the index order changes (i.e., often).
// Run the fixnavi.pl script to adjust the links to the index order.
// **********************************************************************

/*!
    \previouspage creator-editor-settings.html
    \page creator-code-style-settings.html
    \nextpage creator-build-dependencies.html

    \title Specifying Code Style

    \QC uses the \l{Editing MIME Types}{MIME type} of the file to
    determine which mode and editor to use for opening the file.
    \QC opens C++ files in \uicontrol Edit mode in the C++ code editor and
    QML files in the Qt Quick editor.

    \QC uses ClangFormat to enforce the C++ code style specified in a
    \c {.clang-format} file. It uses the
    \l{https://clang.llvm.org/docs/LibFormat.html}{LibFormat} library for
    automatic code formatting and indentation. For more information, see
    \l {Indenting C++ Files}.

    \image qtcreator-code-style-clang-format-project.webp {Code Style settings in Projects mode}

    In rare cases, ClangFormat can trip over a code construct and
    trigger a \QC crash. If that happens for your project, select
    \uicontrol {Formatting mode} > \uicontrol Disable 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.

    To specify a global code style for C++ files, select
    \uicontrol Edit > \uicontrol Preferences > \uicontrol C++.

    \image qtcreator-code-style-clang-format-global.webp {Code Style preferences}

    To specify a global code style for QML files, select
    \uicontrol Edit > \uicontrol Preferences > \uicontrol {Qt Quick}.

    \image qtcreator-code-style-settings-edit-qtquick.png {Code Style view}

    To configure the editor behavior for the current project:

    \list 1

        \li Select \uicontrol Projects > \uicontrol {Project Settings} >
            \uicontrol {Code Style}.

        \li In the \uicontrol Language field, select \uicontrol C++,
            \uicontrol {Qt Quick}, or \uicontrol Nim.

        \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.

    \endlist

    For more information about the settings, see \l{Indenting Text or Code}.

*/
