diff --git a/doc/qtcreator/images/qtcreator-find-from-current-file.webp b/doc/qtcreator/images/qtcreator-find-from-current-file.webp new file mode 100644 index 00000000000..d9296f04ac0 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-find-from-current-file.webp differ diff --git a/doc/qtcreator/images/qtcreator-find-incremental.png b/doc/qtcreator/images/qtcreator-find-incremental.png deleted file mode 100644 index 3bb17a1a41f..00000000000 Binary files a/doc/qtcreator/images/qtcreator-find-incremental.png and /dev/null differ diff --git a/doc/qtcreator/images/qtcreator-search-all-projects.webp b/doc/qtcreator/images/qtcreator-search-all-projects.webp new file mode 100644 index 00000000000..7cabff26631 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-search-all-projects.webp differ diff --git a/doc/qtcreator/images/qtcreator-search-allprojects.png b/doc/qtcreator/images/qtcreator-search-allprojects.png deleted file mode 100644 index c442572f996..00000000000 Binary files a/doc/qtcreator/images/qtcreator-search-allprojects.png and /dev/null differ diff --git a/doc/qtcreator/images/qtcreator-search-file-system.webp b/doc/qtcreator/images/qtcreator-search-file-system.webp new file mode 100644 index 00000000000..31494d1a17f Binary files /dev/null and b/doc/qtcreator/images/qtcreator-search-file-system.webp differ diff --git a/doc/qtcreator/images/qtcreator-search-filesystem.png b/doc/qtcreator/images/qtcreator-search-filesystem.png deleted file mode 100644 index df344a79e33..00000000000 Binary files a/doc/qtcreator/images/qtcreator-search-filesystem.png and /dev/null differ diff --git a/doc/qtcreator/images/qtcreator-search-reg-exp.webp b/doc/qtcreator/images/qtcreator-search-reg-exp.webp new file mode 100644 index 00000000000..a56f9b18d42 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-search-reg-exp.webp differ diff --git a/doc/qtcreator/images/qtcreator-search-results-matches.webp b/doc/qtcreator/images/qtcreator-search-results-matches.webp index 8b49a72fbf2..6a3939e9074 100644 Binary files a/doc/qtcreator/images/qtcreator-search-results-matches.webp and b/doc/qtcreator/images/qtcreator-search-results-matches.webp differ diff --git a/doc/qtcreator/images/qtcreator-search-results-reg-exp.webp b/doc/qtcreator/images/qtcreator-search-results-reg-exp.webp new file mode 100644 index 00000000000..7b2c9aab7a4 Binary files /dev/null and b/doc/qtcreator/images/qtcreator-search-results-reg-exp.webp differ diff --git a/doc/qtcreator/images/qtcreator-search-results.webp b/doc/qtcreator/images/qtcreator-search-results.webp deleted file mode 100644 index d36ec5e2851..00000000000 Binary files a/doc/qtcreator/images/qtcreator-search-results.webp and /dev/null differ diff --git a/doc/qtcreator/src/cmake/creator-projects-cmake-building.qdoc b/doc/qtcreator/src/cmake/creator-projects-cmake-building.qdoc index 90ffd7cd809..a51d6623f88 100644 --- a/doc/qtcreator/src/cmake/creator-projects-cmake-building.qdoc +++ b/doc/qtcreator/src/cmake/creator-projects-cmake-building.qdoc @@ -180,7 +180,7 @@ case-sensitivity. Select \uicontrol {Show Non-matching Lines} to hide the lines that match the filter. - Press \key {Ctrl+F} to \l{Finding and Replacing}{search} for a string from + Press \key {Ctrl+F} to \l{Search in current file}{search} for a string in the output. To increase or decrease the output text size, select \inlineimage icons/plus.png @@ -188,7 +188,7 @@ (\uicontrol {Zoom Out}), or press \key Ctrl++ or \key Ctrl+-. To hide the output, select the \inlineimage icons/rightsidebaricon.png - (\uicontrol {Hide/Show Right Sidebar}) button or press \key {Alt+Shift+0}. + (\uicontrol {Hide Right Sidebar}) button or press \key {Alt+Shift+0}. \section1 CLICOLOR_FORCE Environment Variable diff --git a/doc/qtcreator/src/editors/creator-code-refactoring.qdoc b/doc/qtcreator/src/editors/creator-code-refactoring.qdoc index f286d18f85c..285c36166bd 100644 --- a/doc/qtcreator/src/editors/creator-code-refactoring.qdoc +++ b/doc/qtcreator/src/editors/creator-code-refactoring.qdoc @@ -64,7 +64,7 @@ \endif \endlist - \l{Search Results} shows the location and number of search hits in the + \l{Search Results View} shows the location and number of search hits in the current project. \if defined(qtcreator) diff --git a/doc/qtcreator/src/editors/creator-coding.qdoc b/doc/qtcreator/src/editors/creator-coding.qdoc index 67f8b6ac44d..38c6f3f5963 100644 --- a/doc/qtcreator/src/editors/creator-coding.qdoc +++ b/doc/qtcreator/src/editors/creator-coding.qdoc @@ -36,12 +36,15 @@ key components of \QC. You can use the code editor in the \uicontrol Edit mode. \endif + + \if defined(qtdesignstudio) \li \l{Finding} - Use the incremental and advanced search to search from currently + Use the incremental and advanced search to search in currently open projects or files on the file system or use the locator to browse through projects, files, classes, functions, documentation and file systems. + \endif \li \l{Refactoring} diff --git a/doc/qtcreator/src/editors/creator-diff-editor.qdoc b/doc/qtcreator/src/editors/creator-diff-editor.qdoc index dfeb7f5b4ac..8557cd8bffb 100644 --- a/doc/qtcreator/src/editors/creator-diff-editor.qdoc +++ b/doc/qtcreator/src/editors/creator-diff-editor.qdoc @@ -11,7 +11,7 @@ \page creator-diff-editor.html \if defined(qtdesignstudio) \previouspage qt-quick-toolbars.html - \nextpage creator-finding-overview.html + \nextpage studio-finding.html \else \previouspage creator-macros.html \nextpage creator-clang-codemodel.html diff --git a/doc/qtcreator/src/editors/creator-finding.qdoc b/doc/qtcreator/src/editors/creator-finding.qdoc deleted file mode 100644 index 2ebf1ad0a94..00000000000 --- a/doc/qtcreator/src/editors/creator-finding.qdoc +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2018 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. -// ********************************************************************** - -/*! - \page creator-finding-overview.html - \if defined(qtdesignstudio) - \previouspage creator-diff-editor.html - \else - \previouspage creator-clang-codemodel.html - \endif - - \nextpage creator-editor-finding.html - - \title Finding - - \list - - \li \l{Finding and Replacing} - - The incremental search highlights the matching strings in the - window while typing and the advanced search enables you to - search from currently open projects or files on the file system. - You can conduct incremental and advanced searches in parallel. - - In addition, you can search for symbols when you want to - refactor code. - - \li \l{Searching with the Locator} - - Use the locator to browse - through projects, files, classes, functions, documentation and - file systems. - - \if defined(qtdesignstudio) - \li \l{Jump to the Code} - - Jump to the code for a specific component directly from - the \uicontrol {2D} view or \uicontrol {Navigator} view. - You can also jump to the code of a particular - \uicontrol {State} or \uicontrol {Connection} from their - corresponding views. - \endif - \endlist - -*/ diff --git a/doc/qtcreator/src/editors/creator-locator.qdoc b/doc/qtcreator/src/editors/creator-locator.qdoc index bcdc5278757..292b35ff30c 100644 --- a/doc/qtcreator/src/editors/creator-locator.qdoc +++ b/doc/qtcreator/src/editors/creator-locator.qdoc @@ -2,9 +2,13 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! - \previouspage creator-editor-finding.html \page creator-editor-locator.html + \previouspage creator-how-to-advanced-search.html + \if defined(qtdesignstudio) \nextpage creator-jump-to-the-code.html + \else + \nextpage creator-how-tos.html + \endif \title Searching with the Locator diff --git a/doc/qtcreator/src/editors/creator-only/creator-scxml.qdoc b/doc/qtcreator/src/editors/creator-only/creator-scxml.qdoc index 5c1c32810e1..eac59c47407 100644 --- a/doc/qtcreator/src/editors/creator-only/creator-scxml.qdoc +++ b/doc/qtcreator/src/editors/creator-only/creator-scxml.qdoc @@ -98,7 +98,7 @@ state chart. \endtable - To search from the state chart, select \uicontrol {Search} and start typing + To search in the state chart, select \uicontrol {Search} and start typing in the \uicontrol Filter field. The search checks the whole SCXML tree for attributes that match the search criteria. diff --git a/doc/qtcreator/src/editors/creator-search.qdoc b/doc/qtcreator/src/editors/creator-search.qdoc index a5fd8c9e15a..42ca482a5f3 100644 --- a/doc/qtcreator/src/editors/creator-search.qdoc +++ b/doc/qtcreator/src/editors/creator-search.qdoc @@ -1,29 +1,40 @@ -// Copyright (C) 2022 The Qt Company Ltd. +// Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! - \previouspage creator-finding-overview.html \page creator-editor-finding.html - \nextpage creator-editor-locator.html + \if defined(qtdesignstudio) + \previouspage studio-finding.html + \nextpage creator-how-to-advanced-search.html + \else + \previouspage creator-how-tos.html + \endif - \title Finding and Replacing + \ingroup creator-how-to-search + + \title Search in current file + + The incremental search highlights the matching strings in the editor while + you type. To search through the currently open file: \list 1 - \li Press \key {Ctrl+F} or select \uicontrol Edit > + \li Press \key {Ctrl+F} or go to \uicontrol Edit > \uicontrol {Find/Replace} > \uicontrol {Find/Replace}. \li In \uicontrol Find, enter the text you are looking for. - \image qtcreator-find-incremental.png + \image qtcreator-find-from-current-file.webp {Search hits highlighted in editor} - If the text is found, all occurrences are highlighted as you type. + All occurrences of the text are highlighted in the editor as you + type. - \li To go to the next occurrence, click \inlineimage icons/next.png - (\uicontrol {Find Next}), or press \key F3. To go to the previous - occurrence click \inlineimage icons/prev.png + \li To go to the next occurrence, select \inlineimage icons/next.png + (\uicontrol {Find Next}), or press \key F3. + + \li To go to the previous occurrence, select \inlineimage icons/prev.png (\uicontrol {Find Previous}), or press \key {Shift+F3}. \li To select all found occurrences in a file, select @@ -31,9 +42,13 @@ \endlist - You can restrict the search in the \uicontrol Find field by selecting - \inlineimage icons/qtcreator-new-search-icon.png - . Select one or several search criteria: + \note Select text before selecting \uicontrol {Find/Replace} to search only + from the selection. + + \section1 Set search criteria + + To restrict the search in the \uicontrol Find box, select + \inlineimage icons/qtcreator-new-search-icon.png and set search criteria: \list @@ -42,38 +57,33 @@ \li To search only whole words, select \uicontrol {Whole Words Only}. - \li To search using regular expressions, select + \li To search using \l{QRegularExpression}{regular expressions}, select \uicontrol {Use Regular Expressions}. Regular expressions used in \QC - are modeled on Perl regular expressions. For more information on - using regular expressions, see the documentation for the - QRegularExpression Class. + are modeled on Perl regular expressions \endlist - \note If you have selected text before selecting \uicontrol {Find/Replace}, the - search is conducted within the selection. + \section1 Replace text - To replace occurrences of the existing text, enter the new text in the - \uicontrol {Replace with} field. + To replace occurrences of the existing text, enter the new text in + \uicontrol {Replace with}. \list - + \li To replace the selected occurrence, select \uicontrol {Replace}. \li To replace the selected occurrence and move to the next one, - click \uicontrol {Find Next} or press \key {Ctrl+=}. - - \li To replace the selected occurrence and move to the previous one, - click \uicontrol {Find Previous}. - - \li To replace all occurrences in the file, click + select \uicontrol {Replace & Find}. + \li To replace all occurrences in the file, select \uicontrol {Replace All}. - \endlist - The \uicontrol {Preserve Case when Replacing} option can be selected to - preserve the case of the original text when replacing. This option is not - compatible with the \uicontrol {Use Regular Expressions} search option, and will - thus be disabled when regular expressions are used. When the option is used, - the case of the occurrence will be conserved, according to the following + \section1 Preserve case when replacing + + To preserve the case of the original text when replacing, select + \inlineimage icons/qtcreator-new-search-icon.png and then select + \uicontrol {Preserve Case when Replacing}. You cannot use this option + together with \uicontrol {Use Regular Expressions}. + + The case of the of the occurrence is preserved according to the following rules: \list @@ -88,163 +98,127 @@ \li Other occurrences are replaced with the new text as entered. \li If an occurrence and the new text have the same prefix or suffix, - then the case of the prefix and/or suffix are preserved, and the - other rules are applied on the rest of the occurrence only. + the case of the prefix and suffix are preserved, and the + other rules are applied to the rest of the occurrence. \endlist + \section1 Highlight search hits + The locations of search hits, breakpoints, and bookmarks in your document are highlighted on the editor scroll bar. To turn highlighting off, select \preferences > \uicontrol {Text Editor} > \uicontrol Display > \uicontrol {Highlight search results on the scrollbar}. - To search using more advanced options, select \uicontrol Advanced. + \image qtcreator-options-text-editor-display.png {Text Editor Display preferences} - \section1 Advanced Search + \section1 Search globally - To search through projects, files on a file system, files in all project - directories, or currently open files: + Select \uicontrol Advanced to open the \uicontrol {Search Results} view where + you can search in currently open projects or files on the file system. Or, + search for symbols to refactor code. + + \if defined(qtcreator) + \sa {Search}{How To: Search} + \else + \sa {Search in projects or file systems} + \endif + + \sa {Search Results View} +*/ + +/*! + \page creator-how-to-advanced-search.html + \if defined(qtdesignstudio) + \previouspage creator-editor-finding.html + \nextpage creator-editor-locator.html + \else + \previouspage creator-how-tos.html + \endif + + \ingroup creator-how-to-search + + \title Search in projects or file systems + + The search scope and search criteria determine where \QC looks for the search + string, how it matches the string with text, and which results it shows. + + \section1 Search in all projects \list 1 - - \li Press \key {Ctrl+Shift+F} or select \uicontrol Edit > + \li Press \key {Ctrl+Shift+F} or go to \uicontrol Edit > \uicontrol {Find/Replace} > \uicontrol {Advanced Find} > \uicontrol {Open Advanced Find}. - - \li Select the scope of your search: - - \list - - \li \uicontrol {All Projects} searches from all currently open - projects. - - \image qtcreator-search-allprojects.png - - \if defined(qtcreator) - If you cannot find some files, see - \l{Specify project contents} for how - to declare them as a part of the project. - \endif - - \li \uicontrol {Current Project} searches from the project you - are currently editing. - - \li \uicontrol {Files in All Project Directories} searches from - all project directories. - - \li \uicontrol {Files in File System} recursively searches from - the selected directory. - - \image qtcreator-search-filesystem.png - - In the \uicontrol {Search engine} field, select the search - engine to use: - - \list - \li Select \uicontrol Internal to use the \QC search - engine. - - \li Select \uicontrol {Git Grep} to use Git to only - search tracked files in the Git work tree. To - restrict the search to the HEAD, a tag, a local or - remote branch, or a commit hash, enter a reference. - Leave the field empty to search through the file - system. - - \if defined(qtcreator) - \li Select \uicontrol {Silver Searcher} to use the - experimental Silver Searcher plugin. For more - information, see \l{Enabling Silver Searcher}. - \endif - - \endlist - - \li \uicontrol {Current File} searches only from the current - file. - - \li \uicontrol {Open Documents} searches from all open files. - - \endlist - - \li In the \uicontrol {File pattern} field, specify file patterns to + \li In \uicontrol Scope, select \uicontrol {All Projects}. + \image qtcreator-search-all-projects.webp {Search Results view} + \li In \uicontrol {Search for}, enter the string you are looking for. + \li Select options to make the search case sensitive, search only whole + words, or use regular expressions. + \li In \uicontrol {File pattern}, specify file patterns to restrict the search to files that match the pattern. For example, to search for a string only in \c {.cpp} and \c {.h} files, enter \c {*.cpp,*.h}. - - \li In the \uicontrol {Exclusion pattern} field, specify file patterns + \li In \uicontrol {Exclusion pattern}, specify file patterns to omit files from the search. - - \li Enter the text you are looking for and click \uicontrol Search. - - \image qtcreator-search-results-matches.webp {Found matches in Search Results} - - \l {Search Results} shows a list of files that have the searched text. - - \list - - \li To see all occurrences in a file, double-click the file name - in the list. - - \li To go to an occurrence, double-click it. - - \li To repeat the search after you have made changes to the - listed files, for example, select - \uicontrol {Search Again}. - - \endlist - + \li Select \uicontrol Search. \endlist - The search results are stored in the search history from which you can - select earlier searches. - - To clear the search results, select the \inlineimage icons/clean_pane_small.png - (\uicontrol Clear) button. - - To expand and collapse the search results, select the - \uicontrol {Expand All} button. - - To start a new search, select the \inlineimage icons/qtcreator-new-search-icon.png - (\uicontrol {New Search}) button. - - \note You can use \uicontrol {Advanced Find} also to search for symbols. For - more information, see \if defined(qtcreator) - \l{Finding Symbols}. - \else - \l{Finding QML Types}. + If you cannot find some files, see \l{Specify project contents} for + how to declare them as a part of the project. \endif - \if defined(qtcreator) - \section1 Enabling Silver Searcher + \section1 Search in the file system - You can use Silver Searcher as a search engine in \QC if you install - Silver Searcher on the development PC. - - \note Enable the SilverSearcher plugin to use it. - - To use Silver Searcher: + In addition to the options available for searching from all projects, you can + select the search engine to use and the directory to search in. \list 1 - - \li Download and install Silver Searcher from - \l {https://geoff.greer.fm/ag/}{The Silver Searcher} or - \l {https://github.com/ggreer/the_silver_searcher}{GitHub}. - - You might have to build Silver Searcher from sources for some - platforms. - - \li When searching, select \uicontrol {Silver Searcher} in the - \uicontrol {Search engine} field. - - \li If Silver Searcher is not found, you might have installed it in a - location that is not found via the \c{PATH} environment variable. - Select \preferences > \uicontrol Environment > \uicontrol System, - then select \uicontrol Change in the \uicontrol Environment field, - and add the entry \c{PATH=/path/to/bin:${PATH}}. - + \li In \uicontrol Scope, select \uicontrol {Files in File System}. + \image qtcreator-search-file-system.webp {Search Results view} + \li In \uicontrol {Search for}, enter the string you are looking for. + \li In \uicontrol {Search engine}, select the search engine to use: + \list + \li Select \uicontrol Internal to use the \QC search + engine. + \li Select \uicontrol {Git Grep} to use Git to only + search tracked files in the Git work tree. To + restrict the search to the HEAD, a tag, a local or + remote branch, or a commit hash, enter a reference. + Leave the field empty to search through the file + system. + \if defined(qtcreator) + \li Select \uicontrol {Silver Searcher} to use the + experimental Silver Searcher plugin. + \endif + \endlist + \li In \uicontrol Directory, select the directory to search in. + Select \uicontrol Browse to locate the directory or + \uicontrol Current to search in the directory where the currently + active file is. + \li Select \uicontrol Search. \endlist - \sa {Enable and disable plugins} + \section1 Search and replace + + To replace occurrences of the existing text: + + \list 1 + \li Select \uicontrol {Search & Replace}. + \image qtcreator-search-results-reg-exp.webp {Search results when searching and replacing} + \li Enter the new text in \uicontrol {Replace with}. + \li Select \uicontrol Replace. + \endlist + + To preserve the case of the original text when replacing, + select \uicontrol {Preserve case}. The rules listed in + \l {Preserve case when replacing} apply here as well. + + \if defined(qtcreator) + \sa {Search}{How To: Search}, {Finding Symbols}, {Turn on Silver Searcher} + \else + \sa {Search in current file} \endif + + \sa {Search Results View} */ diff --git a/doc/qtcreator/src/howto/creator-only/creator-how-to-silver-searcher.qdoc b/doc/qtcreator/src/howto/creator-only/creator-how-to-silver-searcher.qdoc new file mode 100644 index 00000000000..b632145832d --- /dev/null +++ b/doc/qtcreator/src/howto/creator-only/creator-how-to-silver-searcher.qdoc @@ -0,0 +1,53 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + +/*! + \page creator-how-to-silver-searcher.html + \previouspage creator-how-tos.html + + \ingroup creator-how-to-search + + \title Turn on Silver Searcher + + You can use Silver Searcher as a search engine in \QC if you install + Silver Searcher on the computer. + + \image qtcreator-search-file-system.webp {Files in File System scope in Search Results view} + + \note Enable the SilverSearcher plugin to use it. + + To use Silver Searcher: + + \list 1 + \li Download and install Silver Searcher from + \l {https://geoff.greer.fm/ag/}{The Silver Searcher} or + \l {https://github.com/ggreer/the_silver_searcher}{GitHub}. + + You might have to build Silver Searcher from sources for some + platforms. + \li When searching, select \uicontrol {Silver Searcher} in + \uicontrol {Search engine}. + \endlist + + If \QC cannot find Silver Searcher, you might have installed it in a + location that is not set in the \c{PATH} environment variable. + + \section1 Set location of Silver Searcher + + To tell \QC where Silver Searcher is: + + \list 1 + \li Go to \preferences > \uicontrol Environment > \uicontrol System. + \image qtcreator-preferences-environment-system.webp {System preferences} + \li In \uicontrol Environment, select \uicontrol Change. + \li In \uicontrol {Edit Environment}, add the path to the Silver Searcher + executable: + \badcode + PATH=:${PATH} + \endcode + \image qtcreator-edit-environment.webp {Edit Environment dialog} + \endlist + + \sa {Enable and disable plugins}, {Search}{How To: Search}, + {Batch edit environment settings} +*/ diff --git a/doc/qtcreator/src/howto/creator-only/creator-how-tos.qdoc b/doc/qtcreator/src/howto/creator-only/creator-how-tos.qdoc index c82cdcfa91c..3696b292635 100644 --- a/doc/qtcreator/src/howto/creator-only/creator-how-tos.qdoc +++ b/doc/qtcreator/src/howto/creator-only/creator-how-tos.qdoc @@ -65,6 +65,10 @@ \generatelist creator-how-to-lsp + \section2 Search + + \generatelist creator-how-to-search + \section1 Manage Kits \generatelist creator-how-to-manage-kits @@ -404,34 +408,43 @@ /*! \page creator-how-to-search-and-replace-using-regexp.html - \previouspage creator-how-to-move-between-open-files.html + \previouspage creator-how-tos.html - \ingroup creator-how-to-edit + \ingroup creator-how-to-search - \title Search and replace across files using a regular expression + \title Search and replace using a regular expression - As an example, say you want to replace equality checks (\c {foo == bar}) - with a function (\c {foo.equals(bar)}): + Search and replace across files using regular expressions in the + \uicontrol {Search Results} view. + + Regular expressions used in \QC are modeled on Perl regular expressions. + For more information about using regular expressions, see + \l QRegularExpression. + + For example, to replace equality checks (\c {foo == bar}) with a function + (\c {foo.equals(bar)}): \list 1 - \li Ensure that any work you have done is committed to version control, - as the changes cannot be undone. - \li Press \key {Ctrl+Shift+F} to bring up the \uicontrol {Advanced Find} - form. - \li Change the scope to whatever is appropriate for your search. - \li Under the \uicontrol {Search for} text field, select - the \uicontrol {Use regular expressions} check box. - \li Enter the following text in the \uicontrol {Search for} text field: + \li Commit your changes to version control, as you cannot undo the + replace action. + \li Press \key {Ctrl+Shift+F} or go to \uicontrol Edit > + \uicontrol {Find/Replace} > \uicontrol {Advanced Find} > + \uicontrol {Open Advanced Find} to open \uicontrol {Search Results}. + \image qtcreator-search-reg-exp.webp {Regular expression in Search Results view} + \li In \uicontrol Scope, select whatever is appropriate for your search. + \li Select \uicontrol {Use regular expressions}. + \li Enter the following text in \uicontrol {Search for}: \badcode if \((.*) == (.*)\) \endcode - \li Press \uicontrol {Search & Replace} to see a list of search results. - \li In the \uicontrol {Replace with} text field, enter the following text: + \li Select \uicontrol {Search & Replace} to see a list of search results. + \image qtcreator-search-results-reg-exp.webp {Search results for the regular expression} + \li In \uicontrol {Replace with}, enter the following text: \badcode if (\1.strictlyEquals(\2)) \endcode - \li Press \uicontrol Replace to replace all instances of the text. + \li Select \uicontrol Replace to replace all instances of the text. \endlist - \sa {Advanced Search}, {Edit Code}{How To: Edit Code}, {Edit Mode} + \sa {Edit Code}{How To: Edit Code}, {Search}{How To: Search}, {Edit Mode} */ diff --git a/doc/qtcreator/src/projects/creator-only/creator-projects-creating.qdoc b/doc/qtcreator/src/projects/creator-only/creator-projects-creating.qdoc index 569342b26e3..60fb9686fd6 100644 --- a/doc/qtcreator/src/projects/creator-only/creator-projects-creating.qdoc +++ b/doc/qtcreator/src/projects/creator-only/creator-projects-creating.qdoc @@ -198,8 +198,8 @@ directory in the \l {File System} view. Declaring files as a part of the project also makes them visible to the - \l{Searching with the Locator}{locator} and \l{Advanced Search} - {project-wide search}. + \l{Searching with the Locator}{locator} and + \l{Search in projects or file systems}{project-wide search}. \section1 CMake Projects diff --git a/doc/qtcreator/src/qtcreator-toc.qdoc b/doc/qtcreator/src/qtcreator-toc.qdoc index ec8408795fc..60f8248b38c 100644 --- a/doc/qtcreator/src/qtcreator-toc.qdoc +++ b/doc/qtcreator/src/qtcreator-toc.qdoc @@ -36,11 +36,6 @@ \li \l{Using Text Editing Macros} \li \l{Comparing Files} \endlist - \li \l{Finding} - \list - \li \l{Finding and Replacing} - \li \l{Searching with the Locator} - \endlist \li \l{Refactoring} \li \l{Configuring the Editor} \li \l{Using GitHub Copilot} @@ -149,6 +144,8 @@ \generatelist creator-how-to-configure-editors \li Manage Language Servers \generatelist creator-how-to-lsp + \li Search + \generatelist creator-how-to-search \endlist \li Manage Kits \generatelist creator-how-to-manage-kits diff --git a/doc/qtcreator/src/qtcreator.qdoc b/doc/qtcreator/src/qtcreator.qdoc index 7c2d8ce775e..aefa86c3946 100644 --- a/doc/qtcreator/src/qtcreator.qdoc +++ b/doc/qtcreator/src/qtcreator.qdoc @@ -50,7 +50,6 @@ \li \b {\l{Coding}} \list \li \l{Writing Code} - \li \l{Finding} \li \l{Refactoring} \li \l{Configuring the Editor} \endlist diff --git a/doc/qtcreator/src/user-interface/creator-file-system-view.qdoc b/doc/qtcreator/src/user-interface/creator-file-system-view.qdoc index 2b4ddbdb942..3b8a7d59cf7 100644 --- a/doc/qtcreator/src/user-interface/creator-file-system-view.qdoc +++ b/doc/qtcreator/src/user-interface/creator-file-system-view.qdoc @@ -68,7 +68,7 @@ To use an \l{Terminal} {internal terminal}, select \preferences > \uicontrol Terminal > \uicontrol {Use internal terminal}. \endif - \li Search from the selected directory. + \li Search in the selected directory. \li View file properties, such as name, path, MIME type, default editor, line endings, indentation, owner, size, last read and modified dates, and permissions. diff --git a/doc/qtcreator/src/user-interface/creator-how-to-view-output.qdoc b/doc/qtcreator/src/user-interface/creator-how-to-view-output.qdoc index b83a54dbe39..95de069becb 100644 --- a/doc/qtcreator/src/user-interface/creator-how-to-view-output.qdoc +++ b/doc/qtcreator/src/user-interface/creator-how-to-view-output.qdoc @@ -60,9 +60,9 @@ \section1 Find and filter output - To search from output, press \key {Ctrl+F} when the view is active. Enter + To search in output, press \key {Ctrl+F} when the view is active. Enter search criteria in the \uicontrol Find field. For more information, see - \l{Finding and Replacing}. + \l{Search in current file}. To filter output, enter a string in the \uicontrol Filter field. diff --git a/doc/qtcreator/src/user-interface/creator-only/creator-reference-terminal-view.qdoc b/doc/qtcreator/src/user-interface/creator-only/creator-reference-terminal-view.qdoc index 2be2fd8a2c3..0f09a773d47 100644 --- a/doc/qtcreator/src/user-interface/creator-only/creator-reference-terminal-view.qdoc +++ b/doc/qtcreator/src/user-interface/creator-only/creator-reference-terminal-view.qdoc @@ -44,7 +44,8 @@ \li To open links in a browser, files in the editor, or folders in the \l Projects view, hover the mouse over them, and press \key Ctrl. - \li To \l{Finding and Replacing}{search} through the output, press \key {Ctrl+F}. + \li To \l{Search in current file}{search} through the output, press + \key {Ctrl+F}. \li To make the font larger or smaller, select the \inlineimage icons/plus.png and \inlineimage icons/minus.png diff --git a/doc/qtcreator/src/user-interface/creator-projects-view.qdoc b/doc/qtcreator/src/user-interface/creator-projects-view.qdoc index b0a66c421cc..99e3b469cc1 100644 --- a/doc/qtcreator/src/user-interface/creator-projects-view.qdoc +++ b/doc/qtcreator/src/user-interface/creator-projects-view.qdoc @@ -89,7 +89,7 @@ \li Add and remove subprojects. \li Find unused functions. \endif - \li Search from the selected directory. + \li Search in the selected directory. \li Open a terminal window in the project directory. To specify the terminal to use on Linux and \macos, select \preferences > diff --git a/doc/qtcreator/src/user-interface/creator-reference-output-views.qdoc b/doc/qtcreator/src/user-interface/creator-reference-output-views.qdoc index 06ee12f0c33..60b8b72d5af 100644 --- a/doc/qtcreator/src/user-interface/creator-reference-output-views.qdoc +++ b/doc/qtcreator/src/user-interface/creator-reference-output-views.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 // ********************************************************************** @@ -78,25 +78,87 @@ \ingroup creator-reference-output-views \ingroup studio-reference-output-views - \title Search Results + \title Search Results View - \brief Lets you search through projects, files on a file system or the - currently open files. + \brief Search through projects, files on a file system or the + currently open files and view search results. - The search history (1) stores the search results. You can select earlier - searches from the history. + The search scope determines where \QC searches for the search string: - \image qtcreator-search-results.webp {Search Results - criteria} + \list + \li \uicontrol {All Projects} searches in all projects. + \li \uicontrol {Current Project} searches in the currently active + project. + \li \uicontrol {Files in All Project Directories} recursively searches + in all project directories. + \li \uicontrol {Files in File System} recursively searches in + the selected directory. + \li \uicontrol {Current File} searches only from the current + file. + \li \uicontrol {Open Documents} searches in all open files. + \endlist - The figure below shows an example search result for all - occurrences of the search string in the specified directory. + In \uicontrol {File pattern} and \uicontrol {Exclusion pattern}, specify + file patterns to further restrict the search scope. - \image qtcreator-search-results-matches.webp {Search Results - matches found} + The search criteria determine how \QC matches the search + string with text and which results it shows: - For more information about the different search options, see - \l {Finding and Replacing}. + \list + + \li To consider case, select \uicontrol {Case sensitive}. + \li To search only whole words, select \uicontrol {Whole words only}. + \li To search using \l{QRegularExpression}{regular expressions}, select + \uicontrol {Use regular expressions}. + \endlist + + \image qtcreator-search-file-system.webp {Search Results view with search options} + + \section1 Viewing Search Results + + After you select \uicontrol Search or \uicontrol {Search & Replace}, the view + shows a list of files that have search hits. + + \image qtcreator-search-results-matches.webp {Found matches in Search Results} + + To show search hits in the editor: + + \list + + \li To see all occurrences in a file, double-click the file name + in the list. + + \li To go to an occurrence, double-click it. + \endlist + + To repeat the search after you have made changes to the listed files, + for example, select \uicontrol {Search Again}. + + \section1 Search Results View Toolbar + + The toolbar contains options for searching again and navigating search + results: + + \list + \li To clear the search results, select + \inlineimage icons/clean_pane_small.png (\uicontrol Clear). + \li To expand and collapse the search results, select + \inlineimage icons/qtcreator-expand.png (\uicontrol {Expand All}). + \li To start a new search, select + \inlineimage icons/qtcreator-new-search-icon.png + (\uicontrol {New Search}). + \li If the active project has long paths, select \uicontrol {../} + (\uicontrol {Show Paths in Relation to Active Project}) to show + relative paths. + \li To show the results of earlier searches, select them in + \uicontrol History. + \endlist \sa {View output} + + \if defined(qtcreator) + \sa {Search}{How To: Search} + \endif */ /*! diff --git a/doc/qtdesignstudio/src/overviews/studio-finding.qdoc b/doc/qtdesignstudio/src/overviews/studio-finding.qdoc new file mode 100644 index 00000000000..bd1e24a5053 --- /dev/null +++ b/doc/qtdesignstudio/src/overviews/studio-finding.qdoc @@ -0,0 +1,39 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + +/*! + \page studio-finding.html + \previouspage creator-diff-editor.html + \nextpage creator-editor-finding.html + + \title Finding + + \list + + \li \l{Search in current file} + + The incremental search highlights the matching strings in the + editor while you type. + + \li \l{Search in projects or file systems} + + With advanced search, you can search in currently open projects or + files on the file system. + + \li \l{Searching with the Locator} + + Use the locator to browse + through projects, files, classes, functions, documentation and + file systems. + + \li \l{Jump to the Code} + + Jump to the code for a specific component directly from + the \uicontrol {2D} view or \uicontrol {Navigator} view. + You can also jump to the code of a particular + \uicontrol {State} or \uicontrol {Connection} from their + corresponding views. + + \endlist + +*/ diff --git a/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc b/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc index 29ef0a9b240..f18a71fb65a 100644 --- a/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc +++ b/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc @@ -211,7 +211,8 @@ \endlist \li \l{Finding} \list - \li \l{Finding and Replacing} + \li \l{Search in current file} + \li \l{Search in projects or file systems} \li \l{Searching with the Locator} \li \l{Jump to the Code} \endlist