forked from qt-creator/qt-creator
Doc: Split up Refactoring into how-to topics
- Move info about viewing search results to the Search Results View reference topic - Remove the Refactoring top-level topic (the general info is now in the Overview topic) Task-number: QTCREATORBUG-29361 Change-Id: I4072e628368905ed1d5006ececae1b9eaa02fa10 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -2,100 +2,35 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
||||
|
||||
/*!
|
||||
\page creator-editor-refactoring.html
|
||||
\previouspage creator-jump-to-the-code.html
|
||||
\nextpage creator-editor-options.html
|
||||
|
||||
\title Refactoring
|
||||
|
||||
To quickly and conveniently apply actions to refactor your
|
||||
code, \l{Apply quick fixes}{select quick fixes in a context menu}.
|
||||
|
||||
By default, the refactored files are saved automatically. To disable
|
||||
this feature, deselect \preferences > \uicontrol Environment >
|
||||
\uicontrol System > \uicontrol {Auto-save files after refactoring}.
|
||||
|
||||
\if defined(qtcreator)
|
||||
\section1 Finding Symbols
|
||||
|
||||
To find instances of a specific symbol in your Qt C++ project, place the
|
||||
cursor on the symbol in the editor and select \uicontrol Tools >
|
||||
\uicontrol {C++} > \uicontrol {Find References to Symbol Under Cursor} or
|
||||
press \key {Ctrl+Shift+U}.
|
||||
|
||||
\image qtcreator-find-references-to-symbol-under-cursor.png {Search results for finding references to symbols}
|
||||
|
||||
To view the same results color-coded according to the access type, such as
|
||||
read, write, or declaration, select \uicontrol Tools > \uicontrol {C++} >
|
||||
\uicontrol {Find References with Access Type}.
|
||||
|
||||
\note Select \uicontrol Edit > \uicontrol {Find/Replace} >
|
||||
\uicontrol {Advanced Find} > \uicontrol {C++ Symbols} to search for
|
||||
classes, functions, enums, and declarations (including type aliases) either
|
||||
from files listed as part of the project or from all files that are used by
|
||||
the code, such as include files.
|
||||
\image qtcreator-search-cpp-symbols.png
|
||||
\endif
|
||||
|
||||
\section1 Viewing Search Results
|
||||
|
||||
\QC searches from the following locations:
|
||||
|
||||
\list
|
||||
\li Files listed as a part of the project
|
||||
\li Files directly used by the project files (for example, generated
|
||||
files)
|
||||
\if defined(qtcreator)
|
||||
\li Header files of used frameworks and libraries
|
||||
\endif
|
||||
\endlist
|
||||
|
||||
\l{Search Results View} shows the location and number of search hits in the
|
||||
current project.
|
||||
|
||||
\if defined(qtcreator)
|
||||
\image qtcreator-refactoring-find.png
|
||||
\page creator-how-to-rename-symbols.html
|
||||
\if defined(qtdesignstudio)
|
||||
\previouspage studio-finding.html
|
||||
\else
|
||||
\image qml-find-usages.png
|
||||
\previouspage creator-how-tos.html
|
||||
\endif
|
||||
|
||||
Browse the search results in the following ways:
|
||||
\ingroup creator-how-to-search
|
||||
|
||||
\list
|
||||
\li To go directly to an instance, double-click the instance in
|
||||
\uicontrol {Search Results}.
|
||||
\li To move between instances, click the \inlineimage icons/next.png
|
||||
(\uicontrol {Next Item}) button and \inlineimage icons/prev.png
|
||||
(\uicontrol {Previous Item}) button in \uicontrol {Search Results}.
|
||||
\li To expand and collapse the list of all instances, click the
|
||||
\inlineimage icons/qtcreator-expand.png
|
||||
(\uicontrol {Expand All}) button.
|
||||
\li To filter the search results for the usage of symbols according to
|
||||
access type, such as read, write, or declaration, click the
|
||||
\inlineimage icons/filtericon.png
|
||||
(\uicontrol {Filter Tree}) button and select the access type.
|
||||
\li To clear the search results, click the
|
||||
\inlineimage icons/clean_pane_small.png
|
||||
(\uicontrol Clear) button.
|
||||
\li To start a new search, click the
|
||||
\inlineimage icons/qtcreator-new-search-icon.png
|
||||
(\uicontrol {New Search}) button.
|
||||
\endlist
|
||||
|
||||
\section1 Renaming Symbols
|
||||
\title Rename symbols
|
||||
|
||||
You can rename symbols in all files in a project.
|
||||
|
||||
\if defined(qtcreator)
|
||||
When you rename a class, you can also change filenames that match the
|
||||
class name.
|
||||
|
||||
To rename a C++ symbol in a project, place the cursor
|
||||
on it and select \uicontrol Tools > \uicontrol {C++} >
|
||||
\uicontrol {Rename Symbol Under Cursor} or press \key {Ctrl+Shift+R}.
|
||||
To rename a C++ symbol in a project:
|
||||
|
||||
\list 1
|
||||
\li Place the cursor on the symbol in the editor.
|
||||
\li Go to \uicontrol Tools > \uicontrol {C++} >
|
||||
\uicontrol {Rename Symbol Under Cursor}, or press \key {Ctrl+Shift+R}.
|
||||
|
||||
Use the keyboard shortcut to rename Python symbols.
|
||||
\endlist
|
||||
\endif
|
||||
|
||||
To rename a QML type in a project, select \uicontrol Tools >
|
||||
To rename a QML type in a project, go to \uicontrol Tools >
|
||||
\uicontrol {QML/JS} > \uicontrol {Rename Symbol Under Cursor}
|
||||
or press \key {Ctrl+Shift+R}.
|
||||
|
||||
@@ -109,23 +44,23 @@
|
||||
\endif
|
||||
|
||||
To replace all selected instances, enter the name of the new symbol
|
||||
in the \uicontrol {Replace with} text box, and select \uicontrol Replace.
|
||||
To omit an instance, deselect the check box next to the instance.
|
||||
in \uicontrol {Replace with}, and select \uicontrol Replace.
|
||||
To omit an instance, clear the check box next to the instance.
|
||||
|
||||
\note This action replaces all selected instances of the symbol in
|
||||
all files listed in \uicontrol {Search Results}. You cannot
|
||||
undo this action.
|
||||
|
||||
\if defined(qtcreator)
|
||||
If the symbol is a class, select the \uicontrol {Rename files} check
|
||||
box to also change the filenames that match the class name.
|
||||
If the symbol is a class, select \uicontrol {Rename files} to also change
|
||||
the filenames that match the class name.
|
||||
|
||||
\note Renaming local symbols does not open \uicontrol {Search Results}.
|
||||
The instances of the symbol are highlighted in code, and you can edit
|
||||
the symbol. All instances of the local symbol are changed as you type.
|
||||
|
||||
\sa {Specify settings for quick fixes}, {Quick Fixes}, {C++ Quick Fixes}
|
||||
|
||||
\sa {Find symbols}, {Specify settings for quick fixes}, {Quick Fixes},
|
||||
{C++ Quick Fixes}
|
||||
\endif
|
||||
|
||||
\sa {Apply quick fixes}, {QML Quick Fixes}
|
||||
|
@@ -46,13 +46,6 @@
|
||||
and file systems.
|
||||
\endif
|
||||
|
||||
\li \l{Refactoring}
|
||||
|
||||
Code refactoring is the process of improving and simplifying code
|
||||
without modifying the existing functionality of an application. You
|
||||
can easily find and rename symbols and apply predefined actions to
|
||||
refactor code.
|
||||
|
||||
\li \l{Configuring the Editor}
|
||||
|
||||
You can change the fonts, colors, highlighting, and indentation.
|
||||
@@ -65,5 +58,7 @@
|
||||
|
||||
\if defined(qtcreator)
|
||||
\sa {Using GitHub Copilot}
|
||||
\else
|
||||
\sa {Apply quick fixes}
|
||||
\endif
|
||||
*/
|
||||
|
@@ -38,7 +38,9 @@
|
||||
|
||||
\li \l{View function tooltips}{Tooltips}
|
||||
|
||||
\li \l{Finding Symbols}{Finding and renaming symbols}
|
||||
\li \l{Find symbols}{Finding symbols}
|
||||
|
||||
\li \l{Rename symbols}{Renaming symbols}
|
||||
|
||||
\li \l{Apply quick fixes}{Quick fixes}
|
||||
|
||||
|
@@ -70,8 +70,8 @@
|
||||
To return non-trivial objects by using a \c const reference, select the
|
||||
\uicontrol {Return non-value types by const reference} check box.
|
||||
|
||||
\sa {Apply quick fixes}, {Specify settings for quick fixes},
|
||||
{C++ Quick Fixes}, {QML Quick Fixes}, {Refactoring}
|
||||
\sa {Apply quick fixes}, {Find symbols}, {Rename symbols},
|
||||
{Specify settings for quick fixes}, {C++ Quick Fixes}, {QML Quick Fixes}
|
||||
*/
|
||||
|
||||
/*!
|
||||
@@ -786,8 +786,8 @@
|
||||
\li Documentation comment for a function
|
||||
\endtable
|
||||
|
||||
\sa {Apply quick fixes}, {Specify settings for quick fixes},
|
||||
{QML Quick Fixes}, {Quick Fixes}, {Refactoring}
|
||||
\sa {Apply quick fixes}, {Find symbols}, {Rename symbols},
|
||||
{Specify settings for quick fixes}, {QML Quick Fixes}, {Quick Fixes}
|
||||
*/
|
||||
|
||||
/*!
|
||||
@@ -811,6 +811,6 @@
|
||||
delete the custom settings, select \uicontrol {Use global settings}, and
|
||||
then select \uicontrol {Delete Custom Settings File}.
|
||||
|
||||
\sa {Apply quick fixes}, {C++ Quick Fixes}, {QML Quick Fixes}, {Quick Fixes},
|
||||
{Configuring Projects}, {Refactoring}
|
||||
\sa {Apply quick fixes}, {Find symbols}, {Rename symbols},
|
||||
{C++ Quick Fixes}, {QML Quick Fixes}, {Quick Fixes}, {Configuring Projects}
|
||||
*/
|
||||
|
@@ -0,0 +1,60 @@
|
||||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
||||
|
||||
/*!
|
||||
\page creator-editor-how-to-find-symbols.html
|
||||
\previouspage creator-how-tos.html
|
||||
|
||||
\ingroup creator-how-to-search
|
||||
|
||||
\title Find symbols
|
||||
|
||||
You can search for references to a particular symbol or search for symbols
|
||||
with a name that matches a pattern.
|
||||
|
||||
\section1 Find references to a symbol
|
||||
|
||||
To find instances of a particular symbol in your Qt C++ project:
|
||||
|
||||
\list 1
|
||||
\li Place the cursor on the symbol in the editor.
|
||||
\li Go to \uicontrol Tools > \uicontrol {C++} >
|
||||
\uicontrol {Find References to Symbol Under Cursor},
|
||||
or press \key {Ctrl+Shift+U}.
|
||||
\image qtcreator-find-references-to-symbol-under-cursor.png {Search results for finding references to symbols}
|
||||
\endlist
|
||||
|
||||
\section2 Color-code access type
|
||||
|
||||
To view the same results color-coded according to the access type, such as
|
||||
read, write, or declaration, go to \uicontrol Tools > \uicontrol {C++} >
|
||||
\uicontrol {Find References with Access Type}.
|
||||
|
||||
\section1 Find symbols that match search criteria
|
||||
|
||||
Go to \uicontrol Edit > \uicontrol {Find/Replace} >
|
||||
\uicontrol {Advanced Find} and select \uicontrol {C++ Symbols} to search for
|
||||
classes, functions, enums, and declarations (including type aliases) either
|
||||
from files listed as part of the project or from all files that are used by
|
||||
the code, such as include files.
|
||||
|
||||
\image qtcreator-search-cpp-symbols.png
|
||||
|
||||
\QC searches from the following locations:
|
||||
|
||||
\list
|
||||
\li Files listed as a part of the project
|
||||
\li Files directly used by the project files (for example, generated
|
||||
files)
|
||||
\li Header files of used frameworks and libraries
|
||||
\endlist
|
||||
|
||||
\section1 View found symbols
|
||||
|
||||
\l{Search Results View} shows the location and number of search hits in the
|
||||
current project.
|
||||
|
||||
\image qtcreator-refactoring-find.png
|
||||
|
||||
\sa {Search}{How To: Search}, {Search Results View}
|
||||
*/
|
@@ -36,8 +36,8 @@
|
||||
\l{Outline} view or in the \uicontrol Symbols list on the
|
||||
\l{Edit Mode}{editor toolbar}
|
||||
\li \l{Call Hierarchy}{Viewing the callers and callees of a function}
|
||||
\li \l{Finding Symbols}{Finding references to symbols}
|
||||
\li \l{Renaming Symbols}{Renaming the symbol under cursor}
|
||||
\li \l{Find references to a symbol}{Finding references to symbols}
|
||||
\li \l{Rename symbols}{Renaming the symbol under the cursor}
|
||||
\li Code actions
|
||||
\li Displaying diagnostics from the language server as tooltips. You can
|
||||
also select a code range to display diagnostics for.
|
||||
|
@@ -4,12 +4,14 @@
|
||||
/*!
|
||||
\page creator-editor-quick-fixes.html
|
||||
\if defined(qtdesignstudio)
|
||||
\previouspage creator-editor-refactoring.html
|
||||
\previouspage creator-jump-to-the-code.html
|
||||
\nextpage creator-reference-qml-quick-fixes.html
|
||||
\else
|
||||
\previouspage creator-how-tos.html
|
||||
\endif
|
||||
|
||||
\ingroup creator-how-to-edit
|
||||
\ingroup studio-code-view
|
||||
|
||||
\title Apply quick fixes
|
||||
|
||||
@@ -35,6 +37,10 @@
|
||||
Or, press \key {Alt+Enter} to open a context menu that has
|
||||
quick fixes available in the current cursor position.
|
||||
|
||||
By default, the refactored files are saved automatically. To turn off
|
||||
this feature, go to \preferences > \uicontrol Environment >
|
||||
\uicontrol System and select \uicontrol {Auto-save files after refactoring}.
|
||||
|
||||
\if defined(qtcreator)
|
||||
\section1 Create functions
|
||||
|
||||
@@ -85,21 +91,24 @@
|
||||
|
||||
\image qtcreator-refactoring-constructor.png "Constructor dialog"
|
||||
|
||||
\sa {Specify settings for quick fixes}, {Quick Fixes}, {C++ Quick Fixes}
|
||||
\sa {Find symbols}, {Specify settings for quick fixes}, {Quick Fixes},
|
||||
{C++ Quick Fixes}
|
||||
\endif
|
||||
|
||||
\sa {QML Quick Fixes}, {Refactoring}
|
||||
\sa {Rename symbols}, {QML Quick Fixes}
|
||||
*/
|
||||
|
||||
/*!
|
||||
\page creator-reference-qml-quick-fixes.html
|
||||
\if defined(qtdesignstudio)
|
||||
\previouspage creator-editor-refactoring.html
|
||||
\previouspage creator-editor-quick-fixes.html
|
||||
\nextpage creator-editor-options.html
|
||||
\else
|
||||
\previouspage creator-reference.html
|
||||
\endif
|
||||
|
||||
\ingroup creator-reference
|
||||
\ingroup studio-code-view
|
||||
|
||||
\title QML Quick Fixes
|
||||
|
||||
@@ -168,10 +177,10 @@
|
||||
|
||||
\endtable
|
||||
|
||||
\sa {Apply quick fixes}, {Refactoring}
|
||||
\sa {Apply quick fixes}, {Rename symbols}
|
||||
|
||||
\if defined(qtcreator)
|
||||
\sa {Exclude files from to-do lists}, {Specify settings for quick fixes},
|
||||
{Quick Fixes}, {C++ Quick Fixes}
|
||||
\sa {Exclude files from to-do lists}, {Find symbols},
|
||||
{Specify settings for quick fixes}, {Quick Fixes}, {C++ Quick Fixes}
|
||||
\endif
|
||||
*/
|
||||
|
@@ -215,7 +215,7 @@
|
||||
\l {Preserve case when replacing} apply here as well.
|
||||
|
||||
\if defined(qtcreator)
|
||||
\sa {Search}{How To: Search}, {Finding Symbols}, {Turn on Silver Searcher}
|
||||
\sa {Search}{How To: Search}, {Find symbols}, {Turn on Silver Searcher}
|
||||
\else
|
||||
\sa {Search in current file}
|
||||
\endif
|
||||
|
@@ -36,7 +36,6 @@
|
||||
\li \l{Using Text Editing Macros}
|
||||
\li \l{Comparing Files}
|
||||
\endlist
|
||||
\li \l{Refactoring}
|
||||
\li \l{Configuring the Editor}
|
||||
\li \l{Using GitHub Copilot}
|
||||
\endlist
|
||||
|
@@ -50,7 +50,6 @@
|
||||
\li \b {\l{Coding}}
|
||||
\list
|
||||
\li \l{Writing Code}
|
||||
\li \l{Refactoring}
|
||||
\li \l{Configuring the Editor}
|
||||
\endlist
|
||||
\li \b {\l{Building and Running}}
|
||||
|
@@ -49,7 +49,7 @@
|
||||
automatically save changed files at the intervals specified in
|
||||
the \uicontrol Interval field.
|
||||
\li Select the \uicontrol {Auto-save files after refactoring} check
|
||||
box to automatically save \l{Refactoring}{refactored files}.
|
||||
box to automatically save refactored files.
|
||||
\li Select the \uicontrol {Auto-suspend unmodified files} check
|
||||
box to automatically free the resources of open files after
|
||||
prolonged inactivity. The files are still listed in the
|
||||
@@ -62,4 +62,10 @@
|
||||
field, set the number of recently opened files listed in
|
||||
\uicontrol File > \uicontrol {Recent Files}.
|
||||
\endlist
|
||||
|
||||
\sa {Apply quick fixes}, {Rename symbols}
|
||||
|
||||
\if defined(qtcreator)
|
||||
\sa {Find symbols}
|
||||
\endif
|
||||
*/
|
||||
|
@@ -142,8 +142,14 @@
|
||||
\list
|
||||
\li To clear the search results, select
|
||||
\inlineimage icons/clean_pane_small.png (\uicontrol Clear).
|
||||
\li To move between instances, select \inlineimage icons/next.png
|
||||
(\uicontrol {Next Item}) and \inlineimage icons/prev.png
|
||||
(\uicontrol {Previous Item}).
|
||||
\li To expand and collapse the search results, select
|
||||
\inlineimage icons/qtcreator-expand.png (\uicontrol {Expand All}).
|
||||
\li To filter the search results for the usage of symbols according to
|
||||
access type, such as read, write, or declaration, select
|
||||
\inlineimage icons/filtericon.png (\uicontrol {Filter Tree}).
|
||||
\li To start a new search, select
|
||||
\inlineimage icons/qtcreator-new-search-icon.png
|
||||
(\uicontrol {New Search}).
|
||||
|
@@ -4,7 +4,7 @@
|
||||
/*!
|
||||
\previouspage creator-editor-locator.html
|
||||
\page creator-jump-to-the-code.html
|
||||
\nextpage creator-editor-refactoring.html
|
||||
\nextpage creator-editor-quick-fixes.html
|
||||
|
||||
\title Jump to the Code
|
||||
|
||||
|
@@ -20,6 +20,10 @@
|
||||
With advanced search, you can search in currently open projects or
|
||||
files on the file system.
|
||||
|
||||
\li \l{Rename symbols}
|
||||
|
||||
Search for QML types and rename them in all files in a project.
|
||||
|
||||
\li \l{Searching with the Locator}
|
||||
|
||||
Use the locator to browse
|
||||
|
@@ -109,7 +109,7 @@
|
||||
However, you can rename symbols in all files within a project. To rename a
|
||||
QML type in a project, select \uicontrol Tools > \uicontrol QML/JS >
|
||||
\uicontrol {Rename Symbol Under Cursor} or press \key Ctrl+Shift+R. For more
|
||||
information, see \l {Renaming Symbols}.
|
||||
information, see \l {Rename symbols}.
|
||||
|
||||
\section2 How can I add .qml files to my project in Qt Creator?
|
||||
|
||||
|
@@ -213,10 +213,12 @@
|
||||
\list
|
||||
\li \l{Search in current file}
|
||||
\li \l{Search in projects or file systems}
|
||||
\li \l{Rename symbols}
|
||||
\li \l{Searching with the Locator}
|
||||
\li \l{Jump to the Code}
|
||||
\endlist
|
||||
\li \l{Refactoring}
|
||||
\li \l{Apply quick fixes}
|
||||
\li \l{QML quick fixes}
|
||||
\li \l{Configuring the Editor}
|
||||
\list
|
||||
\li \l{Font & Colors}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2021 The Qt Company Ltd.
|
||||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
|
||||
|
||||
/*!
|
||||
@@ -17,10 +17,6 @@
|
||||
|
||||
You can also view and modify other types of text files.
|
||||
|
||||
To open the search dialog in the \uicontrol {Code} view, go to
|
||||
\uicontrol Edit > \uicontrol {Find/Replace} > \uicontrol {Find/Replace}.
|
||||
You can also select \key Ctrl + \key {F}.
|
||||
|
||||
The view offers the following features:
|
||||
|
||||
\list
|
||||
@@ -30,4 +26,23 @@
|
||||
\li \l{Indent text or code}
|
||||
\li \l{Using Qt Quick Toolbars}
|
||||
\endlist
|
||||
|
||||
\section1 Refactoring Code
|
||||
|
||||
Code refactoring is the process of improving and simplifying code without
|
||||
modifying the existing functionality of an application. You can easily find
|
||||
and rename symbols and apply quick fixes in the \uicontrol Code view to
|
||||
refactor code.
|
||||
|
||||
\section1 Searching in Code
|
||||
|
||||
To open the search dialog in the \uicontrol {Code} view:
|
||||
|
||||
\list
|
||||
\li Go to \uicontrol Edit > \uicontrol {Find/Replace} >
|
||||
\uicontrol {Find/Replace}.
|
||||
\li Select \key Ctrl + \key {F} (or \key Cmd + \key F on \macos).
|
||||
\endlist
|
||||
|
||||
\sa {Finding}, {Apply quick fixes}, {QML Quick Fixes}
|
||||
*/
|
||||
|
Reference in New Issue
Block a user