Doc: Describe configuring C++ code model for a project

Task-number: QTCREATORBUG-30604
Change-Id: I8f3634fe4282ebe3d364f7762fe651ddb872313f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Leena Miettinen
2024-05-31 15:57:51 +02:00
parent cf64d46bbe
commit 6c98cb780d
3 changed files with 60 additions and 29 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -124,8 +124,34 @@
The document outline in the \l{Outline} view is backed by clangd's document The document outline in the \l{Outline} view is backed by clangd's document
symbol support, which makes the results more reliable than before. symbol support, which makes the results more reliable than before.
\sa {Code Model}, {Clangd}, {Specify clangd settings}, \sa {Configure C++ code model}, {Specify clangd settings},
{Specify Clang tools settings}, {Use compilation databases} {Specify Clang tools settings}, {Use compilation databases},
{Code Model}, {Clangd}
*/
/*!
\page creator-how-to-cpp-code-model.html
\previouspage creator-how-tos.html
\ingroup creator-how-to-configure-editors
\ingroup creator-how-to-projects-configure
\title Configure C++ code model
The code model offers services such as code completion, syntactic and
semantic highlighting, and diagnostics.
To configure the C++ code model for a project:
\list 1
\li Go to \uicontrol Projects > \uicontrol {Project Settings} >
\uicontrol {C++ Code Model}.
\image qtcreator-projects-cpp-code-model.webp {C++ Code Model settings}
\li Clear \uicontrol {Use global settings}.
\li Set \uicontrol {C++ Code Model} settings for the project.
\endlist
\sa {Code Model}
*/ */
/*! /*!
@@ -138,40 +164,43 @@
\brief Sets global preferences for the code model. \brief Sets global preferences for the code model.
The Clang code model offers services such as code completion, syntactic and The code model offers services such as code completion, syntactic and
semantic highlighting, and diagnostics. semantic highlighting, and diagnostics.
To configure the Clang code model globally: To configure the C++ code model globally, go to \preferences >
\uicontrol C++ > \uicontrol {Code Model}.
\list 1
\li Select \preferences > \uicontrol C++ >
\uicontrol {Code Model}.
\image qtcreator-preferences-code-model.webp {C++ Code Model preferences} \image qtcreator-preferences-code-model.webp {C++ Code Model preferences}
\li To instruct the code model to interpret ambiguous header files as C The following table summarizes the preferences.
language files if you develop mainly using C, select the
\uicontrol {Interpret ambiguous headers as C headers} check box.
\li To process precompiled headers, deselect the
\uicontrol {Ignore precompiled headers} check box.
\li To use the built-in preprocessor to show the
pre-processed source file in the editor, select
\uicontrol {Use built-in preprocessor to show pre-processed files}.
\table
\header
\li Setting
\li Value
\row
\li \uicontrol {Interpret ambiguous headers as C headers}
\li Instructs the code model to interpret ambiguous header files as C
language files. Select this checkbox if you develop mainly using C.
\row
\li \uicontrol {Ignore precompiled headers}
\li Clear this checkbox to process precompiled headers.
\row
\li \uicontrol {Use built-in preprocessor to show pre-processed files}
\li Uses the built-in preprocessor to show the
pre-processed source file in the editor.
\row
\li \uicontrol {Do not index files greater than}
\li To avoid out-of-memory crashes caused by indexing huge source files \li To avoid out-of-memory crashes caused by indexing huge source files
that are typically auto-generated by scripts or code, the size of that are typically auto-generated by scripts or code, the size of
files to index is limited to 5MB by default. To adjust the limit, files to index is limited to 5MB by default.
edit the value for the \uicontrol {Do not index files greater than}
check box. To index all files, deselect the check box.
\li To ignore files that match wildcard patterns, select the To index all files, clear the checkbox.
\uicontrol {Ignore files} check box and enter each wildcard pattern \row
on a separate line in the field. \li \uicontrol {Ignore files}
\li To ignore files that match wildcard patterns, enter each wildcard
\endlist pattern on a separate line in the field.
\endtable
\section1 Inspect preprocessed C++ code \section1 Inspect preprocessed C++ code
@@ -186,7 +215,8 @@
this action also expands all \c {"#include <foo.h>"} statements to their this action also expands all \c {"#include <foo.h>"} statements to their
actual contents. actual contents.
\sa {Specify clangd settings}, {Clang Code Model}, {Clangd} \sa {Configure C++ code model}, {Specify clangd settings},
{Clang Code Model}, {Clangd}
*/ */
/*! /*!

View File

@@ -85,6 +85,7 @@
\li \l{Specify clangd settings}{Clangd} \li \l{Specify clangd settings}{Clangd}
\li \l{Specify Clang tools settings}{Clang Tools} \li \l{Specify Clang tools settings}{Clang Tools}
\li \l{Set Copilot preferences}{Copilot} \li \l{Set Copilot preferences}{Copilot}
\li \l{Configure C++ code model}{C++ Code Model}
\li \l{Specify code style}{C++ Code Style} \li \l{Specify code style}{C++ Code Style}
\li \l{Set C++ file naming preferences}{C++ File Naming} \li \l{Set C++ file naming preferences}{C++ File Naming}
\li \l{Specify dependencies}{Dependencies} \li \l{Specify dependencies}{Dependencies}