OSDN Git Service

Doc: finding QML components with Find Usage
[qt-creator-jp/qt-creator-jp.git] / doc / src / editors / creator-editors.qdoc
1 /****************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 **
10 ** GNU Free Documentation License
11 **
12 ** Alternatively, this file may be used under the terms of the GNU Free
13 ** Documentation License version 1.3 as published by the Free Software
14 ** Foundation and appearing in the file included in the packaging of this
15 ** file.
16 **
17 ** If you have questions regarding the use of this file, please contact
18 ** Nokia at info@qt.nokia.com.
19 **
20 ****************************************************************************/
21
22 // **********************************************************************
23 // NOTE: the sections are not ordered by their logical order to avoid
24 // reshuffling the file each time the index order changes (i.e., often).
25 // Run the fixnavi.pl script to adjust the links to the index order.
26 // **********************************************************************
27
28 /*!
29     \contentspage index.html
30     \previouspage creator-project-managing-sessions.html
31     \page creator-coding.html
32     \nextpage creator-editor-using.html
33
34     \title Coding
35
36     Writing, editing, and navigating in source code are core tasks in
37     application development. Therefore, the code editor is one of the key
38     components of \QC. You can use the code editor in the \gui Edit
39     mode.
40
41     The following sections describe coding with \QC:
42
43     \list
44
45         \o  \l{Using the Editor} describes how to work in the code editor, use
46             the editor toolbar, split the view, add bookmarks, and move between
47             symbol definitions and declarations.
48
49         \o  \l{Semantic Highlighting} describes highlighting code elements and
50             blocks, as well as using syntax highlighting also for other types
51             of files than C++ or QML.
52
53         \o  \l{Checking Code Syntax} describes how errors are visualized
54             while you write code.
55
56         \o  \l{Completing Code} describes how code and code snippets are
57             completed for elements, properties, an IDs.
58
59         \o  \l{Indenting Code} describes how to specify indentation either
60             globally for all files or separately for: text, C++, or QML files.
61
62         \o  \l{Finding and Replacing} describes the incremental search that
63             highlights the matching strings in the window while typing and the
64             advanced search that allows you to search from currently open
65             projects or files on the file system. In addition, you can search
66             for symbols when you want to refactor code.
67
68         \o  \l{Refactoring} describes the features that help you improve the
69             internal quality or your application, its performance and
70             extendibility, and code readability and maintainability, as well as
71             to simplify code structure.
72
73         \o  \l{Using Qt Quick Toolbars} describes how to use the Qt Quick
74             Toolbars to edit the properties of QML elements in the code editor.
75
76         \o  \l{Searching With the Locator} describes how to browse through
77             projects, files, classes, methods, documentation and file systems.
78
79         \o  \l{Pasting and Fetching Code Snippets} describes how to cooperate
80             with other developers by pasting and fetching snippets of code from
81             a server.
82
83         \o  \l{Using Text Editing Macros} describes how to record and play
84             text editing macros.
85
86         \o  \l{Configuring the Editor} describes how to change the text editor
87             options to suit your specific needs.
88
89         \o  \l{Using FakeVim Mode} describes how to run the main editor in a
90             manner similar to the Vim editor.
91
92     \endlist
93
94 */
95
96
97 /*!
98     \contentspage index.html
99     \previouspage creator-coding.html
100     \page creator-editor-using.html
101     \nextpage creator-highlighting.html
102
103     \title Using the Editor
104
105     \QC's code editor is designed to aid you in creating, editing and
106     navigating code.  \QC's code editor is fully equipped with syntax
107     checking, code completion, context sensitive help and in-line error
108     indicators while you are typing.
109
110     \image qtcreator-edit-mode.png "Edit mode"
111
112     \section1 Using the Editor Toolbar
113
114     The editor toolbar is located at the top of the editor view. The editor
115     toolbar is context sensitive and shows items relevant to the file currently
116     open in the editor.
117
118     \image qtcreator-editortoolbar-symbols.png
119
120     Use the toolbar to navigate between open files and symbols in use.
121     To browse forward or backward through your location history, click
122            \inlineimage qtcreator-back.png
123            and \inlineimage qtcreator-forward.png
124            .
125
126     To go to any open file, select it from the \gui{Open files} drop-down menu.
127     Right-click the menu title and select \gui {Copy Full Path to Clipboard} to
128     copy the path and name of the current file to the clipboard.
129
130     To jump to any symbol used in the current file, select it from the
131     \gui Symbols drop-down menu. By default, the symbols are displayed in the
132     order in which they appear in the file. Right-click the menu title and
133     select \gui {Sort Alphabetically} to arrange the symbols in alphabetic
134     order.
135
136     \section1 Splitting the Editor View
137
138     Split the editor view when you want to work on and view multiple files on
139     the same screen.
140
141     \image qtcreator-spliteditorview.png
142
143     You can split the editor view in the following ways:
144
145     \list
146
147         \o  To split the editor view into a top and bottom view, select
148             \gui Window > \gui Split or press \key{Ctrl+E, 2}.
149
150             Split command creates views below the currently active editor view.
151
152         \o  To split the editor view into adjacent views, select
153             \gui Window > \gui{Split Side by Side} or press \key{Ctrl+E, 3}.
154
155            Side by side split command creates views to the right of the
156            currently active editor view.
157
158     \endlist
159
160     To move between split views, select \gui Window > \gui{Go to Next Split} or
161     press \key{Ctrl+E, O}.
162
163     To remove a split view, place the cursor within the view you want to
164     remove and select \gui Window > \gui{Remove Current Split} or press
165     \key{Ctrl+E, 0}. To remove all but the currently selected split view,
166     select \gui Window > \gui{Remove All Splits} or press \key{Ctrl+E, 1}.
167
168     \section1 Using Bookmarks
169
170     To insert or delete a bookmark right-click the line number and select
171     \gui{Toggle Bookmark} or press \key{Ctrl+M}.
172
173     \image qtcreator-togglebookmark.png
174
175     To go to previous bookmark in the current session, press \key{Ctrl+,}.
176
177     To go to next bookmark in the current session, press \key{Ctrl+.}.
178
179     \section1 Moving to Symbol Definition or Declaration
180
181     You can move directly to the definition or the declaration of a symbol by
182     holding the \key Ctrl and clicking the symbol.
183
184     To enable this moving function, in \gui Tools > \gui{Options} >
185     \gui{Text Editor} > \gui Behavior, select \gui{Enable mouse navigation}.
186
187     You can also select the symbol and press \key F2, or right-click the symbol
188     and select \gui {Follow Symbol Under Cursor} to move to its definition or
189     declaration. This feature is supported for namespaces, classes, methods,
190     variables, include statements, and macros.
191
192     To switch between the definition and declaration of a symbol, press
193     \key {Shift+F2} or right-click the symbol and select \gui {Switch Between
194     Method Declaration/Definition}.
195
196     \section1 Using Update Code Model
197
198     To refresh the internal information in \QC pertaining to your code,
199     select \gui{Tools} > \gui{C++} > \gui{Update Code Model}.
200
201     \note In \QC indexing updates the code automatically. Use
202     \gui{Update Code Model} only as an emergency command.
203 */
204
205
206 /*!
207     \contentspage index.html
208     \previouspage creator-editor-using.html
209     \page creator-highlighting.html
210     \nextpage creator-checking-code-syntax.html
211
212     \title Semantic Highlighting
213
214     \QC understands the C++ and QML languages as code, not as plain text.
215     It reads the source code, analyzes it, and highlights it based on the
216     semantic checks that it does for the following code elements:
217
218     \list
219
220         \o  Types (such as classes, structs, and type definitions)
221
222         \o  Local variables
223
224         \o  Class fields
225
226         \o  Virtual methods
227
228     \endlist
229
230     To specify the color scheme to use for semantic highlighting, select
231     \gui {Tools > Options > Text Editor > Fonts & Color}.
232
233     \QC supports syntax highlighting also for other types of files than
234     C++ or QML.
235
236     \section1 Generic Highlighting
237
238     Generic highlighting is based on highlight definition files that are
239     provided by the
240     \l{http://kate-editor.org/2005/03/24/writing-a-syntax-highlighting-file/}
241     {Kate Editor}. You can download highlight definition files for use with \QC.
242
243     If you have a Unix installation that comes with the Kate Editor, you might
244     already have the definition files installed. Typically, the files are
245     located in a read-only directory, and therefore, you cannot manage them. \QC
246     can try to locate them and use them as fallback files, when the
247     primary location does not contain the definition for the current file type.
248     You can also specify the directory that contains preinstalled highlight
249     definition files as the primary location.
250
251     When you open a file for editing and the editor cannot find the highlight
252     definition for it, an alert appears. You can turn off the alerts. You can
253     also specify patterns for ignoring files. The editor will not alert you if
254     highlight definitions for the ignored files are not found.
255
256     To download highlight definition files:
257
258     \list 1
259
260         \o  Select \gui {Tools > Options > Text Editor > Generic
261             Highlighter}.
262
263             \image qtcreator-generic-highlighter.png "Generic Highlighter options"
264
265         \o  In the \gui Location field, specify the path to the primary
266             location for highlight definition files.
267
268         \o  Click \gui {Download Definitions} to open a list of highlight
269             definition files available for download.
270
271             \image qtcreator-manage-definitions.png "Download Definitions dialog"
272
273         \o  Select highlight definition files in the list and click
274             \gui {Download Selected Definitions}.
275
276         \o  Select the \gui {Use fallback location} check box to specify the
277             secondary location where the editor will look for highlight
278             definition files.
279
280         \o  Click \gui Autodetect to allow \QC to look for highlight
281             definition files on your system, or click \gui Browse to locate
282             them in the file system yourself.
283
284         \o  In the \gui {Ignored file patterns} field, specify file patterns.
285             You will not receive alerts if the highlight definitions for the
286             specified files are not found.
287
288         \o  Click \gui OK to save your changes.
289
290     \endlist
291
292     \section1 Highlighting and Folding Blocks
293
294     Use block highlighting to visually separate parts of the code that belong
295     together. For example, when you place the cursor within the braces,
296     the code enclosed in braces is highlighted.
297
298     \image qtcreator-blockhighlighting.png
299
300     To enable block highlighting, select \gui Tools > \gui{Options} >
301     \gui{Text Editor} > \gui Display > \gui{Highlight blocks}.
302
303     Use the folding markers to collapse and expand blocks of code within
304     braces. Click the folding marker to collapse or expand a block. In the
305     figure above, the folding markers are located between the line number and
306     the text pane.
307
308     To show the folding markers, select \gui Tools > \gui{Options} >
309     \gui{Text Editor} > \gui Display > \gui{Display folding markers}. This
310     option is enabled by default.
311
312     When the cursor is on a brace, the matching brace is animated
313     by default. To turn off the animation and just highlight the block and
314     the braces, select \gui {Tools > Options > Text Editor > Display} and
315     deselect \gui {Animate matching parentheses}.
316
317 */
318
319
320 /*!
321     \contentspage index.html
322     \previouspage creator-highlighting.html
323     \page creator-checking-code-syntax.html
324     \nextpage creator-completing-code.html
325
326     \title Checking Code Syntax
327
328     As you write code \QC checks code syntax. When \QC spots a syntax error in
329     your code it underlines it and shows error details when you move the mouse
330     pointer over the error.
331
332     \list
333
334         \o  Syntax errors are underlined in red.
335
336             In the following figure, a semicolon is missing at the end of the
337             line.
338
339             \image qtcreator-syntaxerror.png
340
341         \o  Semantic errors and warnings are underlined in olive.
342
343             In the following figure, the type is unknown.
344
345             \image qtcreator-semanticerror.png
346
347     \endlist
348
349     \section1 Checking JavaScript Syntax
350
351     You can run static checks on JavaScript to find common problems, such as:
352
353     \list
354
355         \o  Duplicate or conflicting variable, function, and formal parameter
356             declarations
357
358         \o  Variables and functions that are used before they are declared
359
360         \o  Possibly unsafe uses of the == or != operators
361
362         \o  Comma expressions, except in \c for statements
363
364         \o  Expression statements, except function or method calls, assignments,
365             or \c delete
366
367         \o  Assignments within conditions (such as, \c {if (a = b)})
368
369         \o  Case blocks within a switch that do not end with a return, break,
370             continue, or throw and that are not empty
371
372         \o  Nested block statements
373
374         \o  \c with statements
375
376         \o  \c void expressions
377
378     \endlist
379
380     To run the checks, select \gui {Tools > QML/JS > Run Checks} or press
381     \key Ctrl+Shift+C. The results are shown in the \gui {QML Analysis}
382     filter of the \gui {Issues} output pane.
383
384 */
385
386
387 /*!
388     \contentspage index.html
389     \previouspage creator-checking-code-syntax.html
390     \page creator-completing-code.html
391     \nextpage creator-indenting-code.html
392
393     \title Completing Code
394
395     As you write code, \QC suggests properties, IDs, and code snippets to
396     complete the code. It provides a list of context-sensitive suggestions to
397     the statement currently under your cursor. Press \key Tab
398     or \key Enter to accept the selected suggestion and complete the code.
399
400     \image qtcreator-codecompletion.png
401
402     To open the list of suggestions at any time, press \key{Ctrl+Space}.
403     If only one option is available, \QC inserts it automatically.
404
405     When completion is invoked manually, \QC completes the common prefix
406     of the list of suggestions. This is especially useful for classes with
407     several similarly named members. To disable this functionality, uncheck
408     \gui{Autocomplete common prefix} in the code completion preferences.
409     Select \gui Tools > \gui{Options} > \gui{Text Editor} > \gui Completion.
410
411     By default, code completion considers only the first letter case-sensitive.
412     To apply full or no case-sensitivity, select the option in the
413     \gui {Case-sensitivity} field.
414
415     \section2 Summary of Available Types
416
417     The following table lists available types for code completion and icon
418     used for each.
419
420     \table
421         \header
422             \o Icon
423             \o Description
424         \row
425             \i  \inlineimage completion/class.png
426             \i  A class
427         \row
428             \i  \inlineimage completion/enum.png
429             \i  An enum
430         \row
431             \i  \inlineimage completion/enumerator.png
432             \i  An enumerator (value of an enum)
433         \row
434             \i  \inlineimage completion/func.png
435             \i  A function
436         \row
437             \i  \inlineimage completion/func_priv.png
438             \i  A private function
439         \row
440             \i  \inlineimage completion/func_prot.png
441             \i  A protected function
442         \row
443             \i  \inlineimage completion/var.png
444             \i  A variable
445         \row
446             \i  \inlineimage completion/var_priv.png
447             \i  A private variable
448         \row
449             \i  \inlineimage completion/var_prot.png
450             \i  A protected variable
451         \row
452             \i  \inlineimage completion/signal.png
453             \i  A signal
454         \row
455             \i  \inlineimage completion/slot.png
456             \i  A slot
457         \row
458             \i  \inlineimage completion/slot_priv.png
459             \i  A private slot
460         \row
461             \i  \inlineimage completion/slot_prot.png
462             \i  A protected slot
463         \row
464             \i  \inlineimage completion/keyword.png
465             \i  A C++ keyword
466         \row
467             \i  \inlineimage completion/snippet.png
468             \i  A C++ code snippet
469         \row
470             \i  \inlineimage completion/element.png
471             \i  A QML element
472         \row
473             \i  \inlineimage completion/qmlsnippet.png
474             \i  A QML code snippet
475         \row
476             \i  \inlineimage completion/macro.png
477             \i  A macro
478         \row
479             \i  \inlineimage completion/namespace.png
480             \i  A namespace
481     \endtable
482
483     \section2 Completing Code Snippets
484
485     Code snippets can consist of multiple
486     variables that you specify values for. Select an item in the list and press
487     \key Tab or \key Enter to complete the code. Press \key Tab to
488     move between the variables and specify values for them. When you specify a
489     value for a variable, all instances of the variable within the snippet
490     are renamed.
491
492     \image qmldesigner-code-completion.png "Completing QML code"
493
494     \section2 Editing Code Snippets
495
496     Code snippets specify C++ or QML code constructs. You can add, modify,
497     and remove snippets in the snippet editor. To open the editor, select
498     \gui {Tools > Options > Text Editor > Snippets}.
499
500     \image qtcreator-edit-code-snippets.png "Snippet options"
501
502     \QC provides you with built-in snippets in the following categories:
503
504     \list
505
506         \o  Text snippets, which can contain any text string. For example, code
507             comments
508
509         \o  C++ code snippets, which specify C++ code constructs
510
511         \o  QML code snippets, which specify QML code constructs
512
513     \endlist
514
515     \section3 Adding and Editing Snippets
516
517     Select a snippet in the list to edit it in the snippet editor. To add a new
518     snippet, select \gui Add. Specify a trigger and, if the trigger is already
519     in use, an optional variant, which appear in the list of suggestions when
520     you write code. Also specify a text string or C++ or QML code construct in
521     the snippet editor, depending on the snippet category.
522
523     The snippet editor provides you with:
524
525     \list
526
527         \o  Highlighting
528
529         \o  Indentation
530
531         \o  Parentheses matching
532
533         \o  Basic code completion
534
535     \endlist
536
537     Specify the variables for the snippets in the following format:
538
539     \c $variable$
540
541     Use unique variable names within a snippet, because all instances of a
542     variable are renamed when you specify a value for it.
543
544     The snippet editor does not check the syntax of the snippets that you edit
545     or add. However, when you use the snippets, the code editor marks any
546     errors by underlining them in red.
547
548     To discard the changes you made to a built-in snippet, select \gui {Revert
549     Built-in}.
550
551     \section3 Removing Snippets
552
553     Several similar built-in snippets might be provided for different use
554     cases. To make the list of suggestions shorter when you write code, remove
555     the built-in snippets that you do not need. If you need them later, you
556     can restore them.
557
558     To remove snippets, select a snippet in the list, and then select
559     \gui Remove. To restore the removed snippets, select \gui {Restore Removed
560     Built-ins}.
561
562     \section3 Resetting Snippets
563
564     To remove all added snippets and to restore all removed snippets, select
565     \gui {Reset All}.
566
567     \note If you now select \gui OK or \gui Apply, you permanently lose all
568     your own snippets.
569
570 */
571
572
573 /*!
574     \contentspage index.html
575     \previouspage creator-editor-locator.html
576     \page creator-editor-codepasting.html
577     \nextpage creator-macros.html
578
579     \title Pasting and Fetching Code Snippets
580
581     In \QC, you can paste snippets of code to a server or fetch snippets of code
582     from the server. To paste and fetch snippets of code, \QC uses the
583     following:
584
585     \list
586
587         \o  \gui{CodePaster}
588
589         \o  \gui{Pastebin.Com}
590
591         \o  \gui{Pastebin.Ca}
592
593     \endlist
594
595     To configure the server, select \gui{Tools} > \gui{Options} >
596     \gui{Code Pasting}.
597
598     To paste a snippet of code onto the server, select \gui{Tools} >
599     \gui{Code Pasting} > \gui{Paste Snippet} or press \key{Alt+C,Alt+P}.
600
601     To fetch a snippet of code from the server, select \gui{Tools} >
602     \gui{Code Pasting} > \gui{Fetch Snippet} or press \key{Alt+C,Alt+F}.
603
604     \note To use \gui{Pastebin.Com}, configure the domain
605     prefix in \gui{Tools} > \gui{Options} > \gui{Code Pasting} >
606     \gui{Pastebin.com}.
607
608     For example, you might ask colleagues to review a change that you plan to
609     submit to a version control system. If you use the Git version control
610     system, you can create a \e{diff} view by selecting \gui{Tools > Git >
611     Diff Repository}. You can then upload its contents to the server by choosing
612     \gui{Tools} > \gui{Code Pasting} > \gui{Paste Snippet}. The reviewers can
613     retrieve the code snippet by selecting \gui{Tools > Code Pasting >
614     Fetch Snippet}. If they have the project currently opened in \QC, they can
615     apply and test the change by choosing \gui{Tools > Git > Apply Patch}.
616
617 */
618
619
620 /*!
621     \contentspage index.html
622     \previouspage creator-editor-codepasting.html
623     \page creator-macros.html
624     \nextpage creator-editor-options.html
625
626     \title Using Text Editing Macros
627
628     When you have a file open in the code editor, you can record a keyboard
629     sequence as a macro. You can then play the macro to repeat the sequence.
630     You can save the latest macro and assign a keyboard shortcut for running
631     it or run it from the locator.
632
633     To record a text editing macro, select \gui {Tools > Macros > Record Macro}
634     or press \key {Alt+(}. To stop recording, select \gui {Tools > Macros >
635     Stop Recording Macro} or press \key {Alt+)}.
636
637     To play the last macro, select \gui {Tools > Macros > Play Last Macro} or
638     press \key {Alt+R}.
639
640     To save the last macro, select \gui {Tools > Macros > Save Last Macro}.
641
642     To assign a keyboard shortcut to a text editing macro, select \gui {Tools >
643     Options > Environment > Keyboard}. For more information, see
644     \l{Configuring Keyboard Shortcuts}.
645
646     You can also use the \c rm locator filter to run a macro. For more
647     information, see \l{Searching With the Locator}.
648
649     To view and remove saved macros, select \gui {Tools > Options > Text
650     Editor > Macros}.
651
652 */
653
654
655 /*!
656     \contentspage index.html
657     \previouspage creator-editor-options.html
658     \page creator-editor-fakevim.html
659     \nextpage creator-design-mode.html
660
661     \title Using FakeVim Mode
662
663     In the \gui{FakeVim} mode, you can run the main editor in a manner similar
664     to the Vim editor. To run the editor in the \gui{FakeVim} mode, select
665     \gui{Edit} > \gui{Advanced} > \gui{Use Vim-style Editing} or press
666     \key{Alt+V,Alt+V}.
667
668     In the \gui{FakeVim} mode, most keystrokes in the main editor will be
669     intercepted and interpreted in a way that resembles Vim. Documentation for
670     Vim is not included in \QC. For more information on using Vim,
671     see \l{http://www.vim.org/docs.php}{Documentation} on the Vim web site.
672
673     To map commands entered on the \gui{FakeVim} command line to actions of the
674     \QC core, select \gui{Tools} > \gui{Options} > \gui{FakeVim} >
675     \gui{Ex Command Mapping}.
676
677     To make changes to the Vim-style settings, select \gui{Tools} >
678     \gui{Options} > \gui FakeVim > \gui{General}.
679
680     To use a Vim-style color scheme, select \gui {Tools > Options >
681     Text Editor > Fonts & Color}. In the \gui {Color Scheme} list, select
682     \gui {Vim (dark)}.
683
684     To quit the FakeVim mode, unselect \gui{Tools} > \gui(Options} >
685     \gui{FakeVim} > \gui {Use FakeVim} or press \key{Alt+V,Alt+V}.
686
687     You can temporarily escape FakeVim mode to access the normal \QC
688     keyboard shortcuts like \key{Ctrl-R} for \gui{Run} by pressing
689     \key{,} first.
690
691     */
692
693
694 /*!
695     \contentspage index.html
696     \previouspage creator-macros.html
697     \page creator-editor-options.html
698     \nextpage creator-editor-fakevim.html
699
700     \title Configuring the Editor
701
702     \QC allows you to configure the text editor to suit your specific
703     needs. To configure the editor, select  \gui Tools > \gui{Options} >
704     \gui{Text Editor}.
705
706     These settings apply to all projects. To specify editor behavior for an
707     open project, select \gui {Projects > Editor Settings}. For more
708     information, see \l{Specifying Editor Settings}.
709
710     You can also specify indentation settings separately for C++ and QML files
711     either globally or for the open project. For more information, see
712     \l{Indenting Code}.
713
714     \image qtcreator-font-colors.png "Text editor options"
715
716     You can perform the following configuration actions:
717
718     \list
719
720         \o  Set the font preferences and apply color schemes for syntax
721             highlighting in \gui{Font & Colors}.
722
723         \o  Specify \l{Generic Highlighting}
724             {definition files for syntax highlighting} for other types of files
725              than C++ or QML in \gui{Generic Highlighter}.
726
727         \o  Set tabs, indentation, the handling of whitespace, and mouse
728             operations in \gui Behavior. For more information, see
729             \l{Indenting Code}.
730
731         \o  Set various display properties, for example,
732             \l{Highlighting and folding blocks}
733             {highlighting and folding blocks}, text wrapping or
734             \l{Moving to symbol definition or declaration}
735             {moving to symbol definition or declaration} in \gui Display.
736
737         \o  Add, modify, and remove \l{Editing Code Snippets}{code snippets} in
738             \gui Snippets.
739
740         \o  View and remove \l{Using Text Editing Macros}{text editing macros}
741             in \gui Macros.
742
743         \o  Configure \l{Completing Code}{code completion} in \gui Completion.
744
745     \endlist
746
747     \section2 Configuring Fonts
748
749     You can select the font family and size. You can specify a zoom setting in
750     percentage for viewing the text. You can also zoom in or out by pressing
751     \key {Ctrl++} or \key {Ctrl +-}, or by pressing \key Ctrl and rolling
752     the mouse button up or down. To disable the mouse wheel function, select
753     \gui {Tools > Options > Text Editor > Behavior} and deselect the
754     \gui {Enable scroll wheel zooming} check box.
755
756     Antialiasing is used by default to make text look smoother and more
757     readable on the screen. Deselect the \gui Antialias check box to
758     turn off antialiasing.
759
760     \section2 Defining Color Schemes
761
762     You can select one of the predefined color schemes for syntax highlighting
763     or create customized color schemes. The color schemes apply to highlighting
764     both C++ and QML files and generic files.
765
766     To create a color scheme:
767
768     \list 1
769
770         \o  Select \gui {Tools > Options > Text Editor > Fonts & Color > Copy}.
771
772         \o  Enter a name for the color scheme and click \gui OK.
773
774         \o  In the \gui Foreground field, specify the color of the selected
775             code element.
776
777         \o  In the \gui Background field, select the background
778             color for the code element.
779
780         The backgound of the \gui Text element determines the background of the
781         code editor.
782
783     \endlist
784
785     When you copy code from \QC, it is copied in both plain text and HTML
786     format. The latter makes sure that syntax highlighting is preserved when
787     pasting to a rich-text editor.
788
789     \section2 File Encoding
790
791     To define the default file encoding, select the desired encoding in
792     \gui {Default encoding}. By default, \QC uses the file encoding
793     used by your system.
794
795 */
796
797
798 /*!
799     \contentspage index.html
800     \previouspage creator-completing-code.html
801     \page creator-indenting-code.html
802     \nextpage creator-editor-finding.html
803
804     \title Indenting Code
805
806     When you type code, it is indented automatically according to the selected
807     text editor and code style options. Select a block to indent it when you
808     press \key Tab. Press \key {Shift+Tab} to decrease the indentation. You
809     can disable automatic indentation.
810
811     You can specify indentation either globally for all files or separately
812     for:
813
814     \list
815
816         \o  Text files
817
818         \o  C++ files
819
820         \o  QML files
821
822     \endlist
823
824     You can also specify indentation separately for each project. You can
825     specify several sets of code style settings and easily switch between them.
826     In addition, you can import and export code style settings.
827
828     \section1 Indenting Text Files
829
830     To specify global indentation settings for the text editor, select
831     \gui {Tools > Options > Text Editor > Behavior}. You can also use these
832     settings globally for all editors and files.
833
834     \image qtcreator-indentation.png "Text Editor Behavior options"
835
836     To specify settings for a particular project, select \gui {Projects >
837     Editor Settings}.
838
839     You can specify how to interpret the \key Tab and \key Backspace key
840     presses and how to align continuation lines.
841
842     \section1 Indenting C++ Files
843
844     To specify indentation settings for the C++ editor:
845
846     \list 1
847
848         \o  Select \gui {Tools > Options > C++}.
849
850         \o  In the \gui {Current settings} field, select the settings to modify
851             and click \gui Copy.
852
853             \image qtcreator-options-code-style-cpp.png "C++ Code Style options"
854
855         \o  Give a name to the settings and click \gui OK.
856
857         \o  Click \gui Edit to specify code style settings for the project.
858
859             \image qtcreator-code-style-settings-edit-cpp.png "Edit Code Style Settings dialog"
860
861
862     \endlist
863
864     You can specify how to:
865
866     \list
867
868         \o  Interpret the \key Tab and \key Backspace key presses.
869
870         \o  Indent the contents of classes, methods, blocks, and namespaces.
871
872         \o  Indent braces in classes, namespaces, enums, methods, and blocks.
873
874         \o  Control switch statements and their contents.
875
876         \o  Align continuation lines.
877
878     \endlist
879
880     You can use the live preview to see how the options change the indentation.
881
882     To specify the settings for a particular project, select \gui {Projects >
883     Code Style Settings}.
884
885     \section1 Indenting QML Files
886
887     To specify global settings for the Qt Quick editor:
888
889     \list 1
890
891         \o  Select \gui {Tools > Options >Qt Quick}.
892
893         \o  In the \gui {Current settings} field, select the settings to modify
894             and click \gui Copy.
895
896             \image qtcreator-options-code-style-qml.png "QML Code Style options"
897
898         \o  Give a name to the settings and click \gui OK.
899
900         \o  Click \gui Edit to specify code style settings for the project.
901
902             \image qtcreator-code-style-settings-edit-qtquick.png "Edit Code Style Settings dialog"
903
904     \endlist
905
906     You can specify how to interpret the \key Tab key presses and how to align
907     continuation lines.
908
909     To specify the settings for a particular project, select \gui {Projects >
910     Code Style Settings}.
911
912     \section1 Specifying Tab Settings
913
914     You can specify tab settings at the following levels:
915
916     \list
917
918         \o  Global settings for all files
919
920         \o  Global C++ settings for C++ files
921
922         \o  Global Qt Quick settings for QML files
923
924         \o  Project specific settings for all editors of files in the project
925
926         \o  Project specific settings for C++ files in the project
927
928         \o  Project specific settings for QML files in the project
929
930     \endlist
931
932     \section2 Specifying Tabs and Indentation
933
934     You can specify tab policy and tab size in the \gui Typing group. In the
935     \gui {Tab policy} field, select whether to use only spaces or only tabs for
936     indentation, or to use a mixture of them.
937
938     By default, the tab length in code editor is 8 spaces and the indent size is
939     4 spaces. You can specify the tab length and indent size separately for each
940     project and for different types of files.
941
942     You can have continuation lines aligned with the previous line. In the
943     \gui {Align continuation lines} field, select \gui {Not at all} to disable
944     automatic alignment and indent continuation lines to the logical depth.
945     To always use spaces for alignment, select \gui {With Spaces}. To follow the
946     \gui {Tab policy}, select \gui {With Regular Indent}.
947
948     \section2 Speficying Typing Options
949
950     When you type code, it is indented automatically according to the selected
951     text editor and code style options. Specify typing options in the
952     \gui Typing group. To disable automatic indentation, deselect the
953     \gui {Enable automatic indentation} check box.
954
955     You can specify how the indentation is decreased when you press
956     \gui Backspace in the \gui {Backspace indentation} field. To go back one
957     space at a time, select \gui None. To decrease indentation in leading white
958     space by one level, select \gui {Follows Previous Indents}. To move back one
959     tab length if the character to the left of the cursor is a space, select
960     \gui Unindents.
961
962     You can specify whether the \key Tab key automatically indents text when you
963     press it. To automatically indent text, select \gui Always in the
964     \gui {Tab key performs auto-indent} field. To only indent text when the
965     cursor is located within leading white space, select \gui {In Leading White
966     Space}.
967
968     \section1 Specifying Settings for Content
969
970     You can indent public, protected, and private statements and declarations
971     related to them within classes.
972
973     You can also indent statements within methods and blocks and declarations
974     within namespaces.
975
976     \image qtcreator-code-style-content.png "Content options"
977
978     \section1 Specifying Settings for Braces
979
980     You can indent class, namespace, enum and method declarations and code
981     blocks.
982
983     \image qtcreator-code-style-braces.png "Braces options"
984
985     \section1 Specifying Settings for Switch Statements
986
987     You can indent case or default statements, or statements or blocks related
988     to them within switch statements.
989
990     \image qtcreator-code-style-switch.png "Switch options"
991
992     \section1 Specifying Alignment
993
994     To align continuation lines to tokens after assignments, such as = or
995     +=, select the \gui {Align after assignments} check box. You can specify
996     additional settings for aligning continuation lines in the \gui General
997     tab.
998
999     You can also add spaces to conditional statements, so that they are not
1000     aligned with the following line. Usually, this only affects \c if
1001     statements.
1002
1003     \image qtcreator-code-style-alignment.png "Alignment options"
1004
1005 */
1006
1007
1008 /*!
1009     \contentspage index.html
1010     \previouspage creator-indenting-code.html
1011     \page creator-editor-finding.html
1012     \nextpage creator-editor-refactoring.html
1013
1014     \title Finding and Replacing
1015
1016     To search through the currently open file:
1017
1018     \list 1
1019
1020         \o  Press \key Ctrl+F or select \gui Edit > \gui Find/Replace >
1021             \gui{Find/Replace}.
1022
1023         \o  Enter the text you are looking for.
1024
1025             If the text is found, all occurrences are highlighted as you type.
1026
1027         \o  To go to the next occurrence, click \inlineimage qtcreator-next.png
1028             , or press \key F3. To go to the previous occurrence click
1029             \inlineimage qtcreator-previous.png
1030             , or press \key Shift+F3.
1031
1032     \endlist
1033
1034     You can restrict the search in the \gui Find field by selecting one
1035     or several search criteria:
1036
1037     \list
1038
1039         \o  To make your search case sensitive, select
1040             \inlineimage qtcreator-editor-casesensitive.png
1041             .
1042
1043         \o  To search only whole words, select
1044             \inlineimage qtcreator-editor-wholewords.png
1045             .
1046
1047         \o  To search using regular expressions, select
1048             \inlineimage qtcreator-editor-regularexpressions.png
1049             .
1050             Regular expressions used in \QC are modeled on Perl regular
1051             expressions. For more information on using regular expressions, see
1052             \l {http://doc.qt.nokia.com/4.7/qregexp.html#details}
1053             {Detailed Description} in the QRegExp Class Reference.
1054
1055     \endlist
1056
1057     \note If you have selected text before selecting \gui Find/Replace, the
1058     search is conducted within the selection.
1059
1060     To replace occurrences of the existing text, enter the new text in the
1061     \gui{Replace with} field.
1062
1063     \list
1064
1065         \o  To replace the selected occurrence and move to the next one,
1066             click \inlineimage qtcreator-next.png
1067             or press \key Ctrl+=.
1068
1069         \o  To replace the selected occurrence and move to the previous one,
1070             click \inlineimage qtcreator-previous.png
1071             .
1072
1073         \o  To replace all occurrences in the file, click \gui{Replace All}.
1074
1075     \endlist
1076
1077     \section1 Advanced Search
1078
1079     To search through projects, files on a file system or the currently open
1080     file:
1081
1082     \list 1
1083
1084         \o  Press \key Ctrl+Shift+F or select \gui Edit > \gui Find/Replace >
1085             \gui{Advanced Find} > \gui{Open Advanced Find}.
1086
1087         \o  Select the scope of your search:
1088
1089             \list
1090
1091                 \o  \gui{All Projects} searches files matching the defined file
1092                     pattern in all currently open projects.
1093
1094                     For example, to search for \tt previewer only in \tt .cpp
1095                     and \tt .h files, enter in \gui{File pattern}
1096                     \tt *.cpp,*.h.
1097
1098                     \image qtcreator-search-allprojects.png
1099
1100                 \o  \gui{Current Project} searches files matching the defined
1101                     file pattern only in the project you are currently editing.
1102
1103                 \o  \gui{Files on File System} recursively searches files
1104                     matching the defined file pattern in the selected directory.
1105
1106                 \o  \gui{Current File} searches only the current file.
1107
1108             \endlist
1109
1110         \o  Enter the text you are looking for and click \gui Search.
1111
1112             \image qtcreator-searchresults.png
1113
1114              A list of files containing the searched text is displayed in the
1115             \gui{Search Results} pane.
1116
1117             \list
1118
1119                 \o  To see all occurrences in a file, double-click the file name
1120                     in the list.
1121
1122                 \o  To go to an occurrence, double-click it.
1123
1124             \endlist
1125
1126     \endlist
1127
1128     \note You can use \gui{Advanced Find} also to search for symbols. For more
1129     information, see \l{Finding Symbols}.
1130
1131 */
1132
1133
1134 /*!
1135     \contentspage index.html
1136     \previouspage creator-editor-finding.html
1137     \page creator-editor-refactoring.html
1138     \nextpage qt-quick-toolbars.html
1139
1140     \title Refactoring
1141
1142     Code refactoring is the process of changing the code without modifying the
1143     existing functionality of your application. By refactoring your code you
1144     can:
1145
1146     \list
1147
1148         \o  Improve internal quality of your application
1149
1150         \o  Improve performance and extensibility
1151
1152         \o  Improve code readability and maintainability
1153
1154         \o  Simplify code structure
1155
1156     \endlist
1157
1158     \section1 Finding Symbols
1159
1160     To find the use of a specific symbol or \l{glossary-component}
1161     {QML component} in your Qt C++ or Qt Quick project:
1162
1163     \list 1
1164
1165         \o  In the editor, place the cursor on the symbol or component, and
1166             select:
1167
1168         \list
1169
1170             \o  \gui {Tools > C++ > Find Usages}
1171
1172             \o  \gui {Tools > QML/JS > Find Usages}
1173
1174             \o  \key Ctrl+Shift+U
1175
1176         \endlist
1177
1178         \QC  looks for the symbol in the following locations:
1179
1180         \list
1181
1182             \o  Files listed as a part of the project
1183
1184             \o  Files directly used by the project files (for example, generated
1185                 files)
1186
1187             \o  Header files of used frameworks and libraries
1188
1189         \endlist
1190
1191         \note You can also select \gui{Edit > Find/Replace > Advanced Find >
1192         C++ Symbols} to search for classes, methods, enums, and declarations
1193         either from files listed as part of the project or from all files that
1194         are used by the code, such as include files.
1195
1196         \image qtcreator-search-cpp-symbols.png
1197
1198         \o  The \gui{Search Results} pane opens and shows the location and
1199             number of instances of the symbol in the current project.
1200
1201             \image qtcreator-refactoring-find.png
1202
1203     \endlist
1204
1205     You can browse the search results in the following ways:
1206
1207     \list
1208
1209         \o  To go directly to an instance, double-click the instance in the
1210             \gui{Search Results} pane.
1211
1212         \o  To move between instances, click
1213             \inlineimage qtcreator-forward.png
1214             and
1215             \inlineimage qtcreator-back.png
1216             in the \gui{Search Results} pane.
1217
1218         \o  To expand and collapse the list of all instances, click
1219             \inlineimage qtcreator-expand.png
1220             .
1221
1222         \o  To clear the search results, click \inlineimage qtcreator-clear.png
1223             .
1224
1225     \endlist
1226
1227     \section1 Renaming Symbols
1228
1229     To rename a specific symbol in a Qt project:
1230
1231     \list 1
1232
1233         \o  In the editor, place the cursor on the symbol you would like to
1234             change and select \gui Tools > \gui C++ >
1235             \gui{Rename Symbol Under Cursor} or \gui Tools > \gui QML/JS >
1236             \gui{Rename Symbol Under Cursor}. Alternatively, press
1237             \key Ctrl+Shift+R.
1238
1239             The \gui{Search Results} pane opens and shows the location and
1240             number of instances of the symbol in the current project.
1241
1242             \image qtcreator-refactoring-replace.png
1243
1244         \o  To replace all selected instances, enter the name of the new symbol
1245             in the \gui{Replace with} text box and click \gui Replace.
1246
1247             To omit an instance, uncheck the check-box next to the instance.
1248
1249             \note This action replaces all selected instances of the symbol in
1250             all files listed in the \gui{Search Results} pane. You cannot
1251             undo this action.
1252
1253     \endlist
1254
1255     \note Renaming local symbols does not open the \gui{Search Results} pane.
1256     The instances of the symbol are highlighted in code and you can edit the
1257     symbol. All instances of the local symbol are changed as you type.
1258
1259     \section1 Applying Refactoring Actions
1260
1261     \QC allows you to quickly and conveniently apply actions to refactor
1262     your code by selecting them in a context menu. The actions available depend
1263     on the position of the cursor in the code editor and on whether you are
1264     writing C++ or QML code.
1265
1266     To apply refactoring actions to C++ code, right-click an operand,
1267     conditional statement, string, or name to open a context menu. In QML code,
1268     click an element ID or name.
1269
1270     In the context menu, select \gui {Refactoring} and then select a refactoring
1271     action.
1272
1273     You can also press \gui {Alt+Enter} to open a context menu that contains
1274     refactoring actions available in the current cursor position.
1275
1276    \section2 Refactoring C++ Code
1277
1278    You can apply the following types of refactoring actions to C++ code:
1279
1280    \list
1281
1282         \o  Change binary operands
1283
1284         \o  Simplify if and while conditions (for example, move declarations out
1285             of if conditions)
1286
1287         \o  Modify strings (for example, set the encoding for a string to
1288             Latin-1, mark strings translatable, and convert symbol names to
1289             camel case)
1290
1291         \o  Create variable declarations
1292
1293         \o  Create method declarations and definitions
1294
1295    \endlist
1296
1297     The following table summarizes the refactoring actions for C++ code. The
1298     action is available when the cursor is in the position described in the
1299     Activation column.
1300
1301     \table
1302         \header
1303             \i Refactoring Action
1304             \i Description
1305             \i Activation
1306         \row
1307             \i Add Curly Braces
1308             \i Adds curly braces to an if statement that does not contain a
1309             compound statement. For example, rewrites
1310
1311     \code
1312     if (a)
1313         b;
1314     \endcode
1315
1316             as
1317
1318     \code
1319     if (a) {
1320         b;
1321     }
1322     \endcode
1323             \i if
1324         \row
1325             \i Move Declaration out of Condition
1326             \i Moves a declaration out of an if or while condition to simplify the
1327             condition. For example, rewrites
1328
1329     \code
1330     if (Type name = foo()) {}
1331     \endcode
1332
1333             as
1334
1335     \code
1336     Type name = foo;
1337     if (name) {}
1338     \endcode
1339             \i Name of the introduced variable
1340         \row
1341             \i Rewrite Condition Using ||
1342             \i Rewrites the expression according to De Morgan's laws. For example,
1343              rewrites:
1344     \code
1345     !a && !b
1346     \endcode
1347
1348             as
1349
1350     \code
1351     !(a || b)
1352     \endcode
1353             \i &&
1354         \row
1355             \i Rewrite Using \e operator
1356             \i Rewrites an expression negating it and using the inverse operator. For
1357             example, rewrites:
1358
1359             \list
1360
1361     \o     \code
1362     a op b
1363     \endcode
1364
1365     as
1366
1367     \code
1368     !(a invop b)
1369     \endcode
1370
1371     \o     \code
1372     (a op b)
1373     \endcode
1374
1375     as
1376
1377     \code
1378     !(a invop b)
1379     \endcode
1380
1381     \o    \code
1382     !(a op b)
1383     \endcode
1384
1385     as
1386
1387     \code
1388     (a invob b)
1389     \endcode
1390
1391     \endlist
1392
1393             \i <= < > >= == !=
1394         \row
1395             \i Split Declaration
1396             \i Splits a simple declaration into several declarations. For example,
1397             rewrites:
1398     \code
1399     int *a, b;
1400     \endcode
1401
1402     as
1403
1404     \code
1405     int *a;
1406     int b;
1407     \endcode
1408             \i Type name or variable name
1409         \row
1410             \i Split if Statement
1411             \i Splits an if statement into several statements. For example, rewrites:
1412     \code
1413     if (something && something_else) {
1414     }
1415     \endcode
1416
1417     as
1418
1419     \code
1420     if (something) {
1421        if (something_else) {
1422        }
1423     }
1424     \endcode
1425
1426     and
1427
1428     \code
1429     if (something || something_else)
1430         x;
1431     \endcode
1432
1433     with
1434
1435     \code
1436     if (something)
1437         x;
1438     else if (something_else)
1439         x;
1440     \endcode
1441
1442             \i && ||
1443         \row
1444             \i Swap Operands
1445             \i Rewrites an expression in the inverse order using the inverse operator.
1446             For example, rewrites:
1447     \code
1448     a op b
1449     \endcode
1450
1451     as
1452     \code
1453     b flipop a
1454     \endcode
1455             \i <= < > >= == != && ||
1456         \row
1457             \i Convert to Decimal
1458             \i Converts an integer literal to decimal representation
1459             \i Numeric literal
1460         \row
1461             \i Convert to Hexadecimal
1462             \i Converts an integer literal to hexadecimal representation
1463             \i Numeric literal
1464         \row
1465             \i Convert to Octal
1466             \i Converts an integer literal to octal representation
1467             \i Numeric literal
1468         \row
1469             \i Convert to Objective-C String Literal
1470             \i Converts a string literal to an Objective-C string literal
1471             if the file type is Objective-C(++). For example, rewrites the following strings
1472
1473     \code
1474     "abcd"
1475     QLatin1String("abcd")
1476     QLatin1Literal("abcd")
1477     \endcode
1478
1479     as
1480
1481     \code
1482     @"abcd"
1483     \endcode
1484             \i String literal
1485         \row
1486             \i Enclose in QLatin1Char()
1487             \i Sets the encoding for a character to Latin-1, unless the character is
1488             already enclosed in QLatin1Char, QT_TRANSLATE_NOOP, tr, trUtf8,
1489             QLatin1Literal, or QLatin1String. For example, rewrites
1490
1491     \code
1492     'a'
1493     \endcode
1494
1495     as
1496
1497     \code
1498     QLatin1Char('a')
1499     \endcode
1500             \i String literal
1501         \row
1502             \i Enclose in QLatin1String()
1503             \i Sets the encoding for a string to Latin-1, unless the string is
1504             already enclosed in QLatin1Char, QT_TRANSLATE_NOOP, tr, trUtf8,
1505             QLatin1Literal, or QLatin1String. For example, rewrites
1506     \code
1507     "abcd"
1508     \endcode
1509
1510     as
1511
1512     \code
1513     QLatin1String("abcd")
1514     \endcode
1515
1516             \i String literal
1517
1518         \row
1519             \i Mark as Translatable
1520             \i Marks a string translatable. For example, rewrites \c "abcd" with
1521             one of the following options, depending on which of them is available:
1522
1523     \code
1524     tr("abcd")
1525     QCoreApplication::translate("CONTEXT", "abcd")
1526     QT_TRANSLATE_NOOP("GLOBAL", "abcd")
1527     \endcode
1528
1529             \i String literal
1530
1531         \row
1532             \i #include Header File
1533             \i Adds the matching #include statement for a forward-declared class or struct
1534             \i Forward-declared class or struct
1535         \row
1536             \i Add Definition in 'filename'
1537             \i Inserts a definition stub for a member function declaration in the
1538             implementation file. The definition is placed after that of the
1539             preceding declaration. Qualified names are minimized when possible,
1540             instead of always being fully expanded.
1541
1542             \i Method name
1543         \row
1544             \i Add 'Function' Declaration
1545             \i Inserts the member function declaration that matches the member function
1546             definition into the class declaration. The function can be public,
1547             protected, private, public slot, protected slot, or private slot.
1548             \i Method name
1549         \row
1550             \i Add Local Declaration
1551             \i
1552             Adds the type of an assignee, if the type of the right-hand side of the assignment
1553             is known. For example, rewrites
1554
1555     \code
1556     a = foo();
1557     \endcode
1558
1559     as
1560
1561     \code
1562     Type a = foo();
1563     \endcode
1564
1565     where Type is the return type of \c {foo()}
1566
1567             \i Assignee
1568
1569         \row
1570             \i Convert to Camel Case
1571             \i Converts a symbol name to camel case, where elements of the name are joined
1572             without delimiter characters and the initial character of each element is
1573             capitalized. For example, rewrites \c an_example_symbol
1574             as \c anExampleSymbol and \c AN_EXAMPLE_SYMBOL as \c AnExampleSymbol
1575             \i Identifier
1576         \row
1577             \i Complete Switch Statement
1578             \i Adds all possible cases to a switch statement of the type \c enum
1579             \i Switch
1580         \row
1581             \i Generate Missing Q_PROPERTY Members
1582             \i Adds missing members to a Q_PROPERTY:
1583             \list
1584                 \o \c read method
1585                 \o \c write method, if there is a WRITE
1586                 \o \c {onChanged} signal, if there is a NOTIFY
1587                 \o data member with the name \c {m_<propertyName>}
1588             \endlist
1589             \i Q_PROPERTY
1590         \row
1591             \i  Apply Changes
1592             \i  Keeps function declarations and definitions synchronized by
1593                 checking for the matching declaration or definition when you
1594                 edit a function signature and by applying the changes to the
1595                 matching code.
1596             \i  Function signature. When this action is available, a light bulb
1597                 icon appears:
1598                 \inlineimage qml-toolbar-indicator.png
1599     \endtable
1600
1601    \section2 Refactoring QML Code
1602
1603    You can apply the following types of refactoring actions to QML code:
1604
1605    \list
1606
1607         \o Rename IDs
1608
1609         \o Split initializers
1610
1611         \o Move a QML element into a separate file to reuse it in other
1612         .qml files
1613
1614    \endlist
1615
1616     The following table summarizes the refactoring actions for QML code. The
1617     action is available when the cursor is in the position described in the
1618     Activation column.
1619
1620     \table
1621         \header
1622             \i Refactoring Action
1623             \i Description
1624             \i Activation
1625
1626         \row
1627             \i Move Component into 'filename.qml'
1628             \i Moves a QML element into a separate file
1629             \i Element name
1630         \row
1631             \i Rename id
1632             \i Renames all instances of an element ID in the currently open file
1633             \i Element ID
1634         \row
1635             \i Split Initializer
1636             \i Reformats a one-line element into a multi-line element. For example,
1637             rewrites
1638
1639     \code
1640     Item { x: 10; y: 20; width: 10 }
1641     \endcode
1642
1643     as
1644
1645     \code
1646     Item {
1647         x: 10;
1648         y: 20;
1649         width: 10
1650     }
1651     \endcode
1652             \i Element property
1653
1654     \endtable
1655    */
1656
1657
1658 /*!
1659     \contentspage index.html
1660     \previouspage qt-quick-toolbars.html
1661     \page creator-editor-locator.html
1662     \nextpage creator-editor-codepasting.html
1663
1664     \title Searching With the Locator
1665
1666     The locator provides one of the easiest ways in \QC to browse through
1667     projects, files, classes, methods, documentation and file systems. You can
1668     find the locator in the bottom left of the \QC window.
1669
1670     To activate the locator, press \key Ctrl+K (\key Cmd+K on Mac OS X) or
1671     select \gui Tools > \gui Locate.
1672
1673     \image qtcreator-locator.png
1674
1675     To edit the currently open project's main.cpp file using the locator:
1676
1677     \list 1
1678
1679         \o  Activate the locator by pressing \key Ctrl+K.
1680
1681         \o  Enter \tt{main.cpp}.
1682
1683             \image qtcreator-locator-open.png
1684
1685         \o  Press \key Return.
1686
1687             The main.cpp file opens in the editor.
1688
1689     \endlist
1690
1691     It is also possible to enter only a part of a search string. As you type,
1692     the locator shows the occurrences of that string regardless of where in the
1693     name of an component it appears.
1694
1695     To narrow down the search results, you can use the following wildcard
1696     characters:
1697
1698     \list
1699
1700         \o  To match any number of any or no characters, enter \bold{*}.
1701
1702         \o  To match a single instance of any character, enter \bold{?}.
1703
1704     \endlist
1705
1706     \section1 Using the Locator Filters
1707
1708     The locator allows you to browse not only files, but any items defined by
1709     \bold{locator filters}. By default, the locator contains filters for:
1710
1711     \list
1712
1713         \o  Locating any open document
1714
1715         \o  Locating files anywhere on your file system
1716
1717         \o  Locating iles belonging to your project, such as source, header
1718             resource, and .ui files
1719
1720         \o  Locating class and method definitions in your project or anywhere
1721             referenced from your project
1722
1723         \o  Locating class and method definitions in the current document
1724
1725         \o  Locating a specific line in the document displayed in your editor
1726
1727         \o  Opening help topics, including Qt documentation
1728
1729         \o  Performing web searches
1730
1731         \o  Running text editing macros that you record and save. For more
1732             information, see \l{Using Text Editing Macros}
1733
1734     \endlist
1735
1736     To use a specific locator filter, type the assigned prefix followed by
1737     \key Space. The prefix is usually a single character.
1738
1739     For example, to locate symbols matching QDataStream:
1740
1741     \list 1
1742
1743         \o  Activate the locator.
1744
1745         \o  Enter \tt{\bold{: QDataStream}} (: (colon) followed by a
1746             \key Space and the symbol name (QDataStream)).
1747
1748             The locator lists the results.
1749
1750             \image qtcreator-navigate-popup.png
1751
1752     \endlist
1753
1754     By default, the following filters are enabled and you do not need to use
1755     their prefixes explicitly:
1756
1757     \list
1758
1759         \o  Going to a line in the current file (l).
1760
1761         \o  Going to an open file (o).
1762
1763         \o  Going to a file in any open project (a).
1764
1765     \endlist
1766
1767     \section2 Using the Default Locator Filters
1768
1769     The following locator filters are available by default:
1770
1771     \table
1772         \header
1773             \o  Function
1774             \o  Enter in locator
1775             \o  Example
1776         \row
1777             \o  Go to a line in the current file.
1778             \o  \tt{\bold{l \e{Line number}}}
1779             \o  \image qtcreator-locator-line.png
1780         \row
1781             \o  Go to a symbol definition.
1782             \o  \tt{\bold{: \e{Symbol name}}}
1783             \o  \image qtcreator-locator-symbols.png
1784         \row
1785             \o  Go to a symbol definition in the current file.
1786             \o  \tt{\bold{. \e{Symbol name}}}
1787             \o  \image qtcreator-locator-method-list.png
1788         \row
1789             \o  Go to a help topic.
1790             \o  \tt{\bold{? \e{Help topic}}}
1791             \o  \image qtcreator-locator-help.png
1792         \row
1793             \o  Search for a term by using a web search engine.
1794             \o  \tt{\bold{r \e{Search term}}}
1795             \o  \image qtcreator-locator-web.png
1796         \row
1797             \o  Go to an open file.
1798             \o  \tt{\bold{o \e{File name}}}
1799             \o  \image qtcreator-locator-opendocs.png
1800         \row
1801             \o  Go to a file in the file system (browse the file system).
1802             \o  \tt{\bold{f \e{File name}}}
1803             \o  \image qtcreator-locator-filesystem.png
1804         \row
1805             \o  Go to a file in any project currently open.
1806             \o  \tt{\bold{a \e{File name}}}
1807             \o  \image qtcreator-locator-files.png
1808         \row
1809             \o  Go to a file in the current project.
1810             \o  \tt{\bold{p \e{File name}}}
1811             \o  \image qtcreator-locator-current-project.png
1812         \row
1813             \o  Go to a class definition.
1814             \o  \tt{\bold{c \e{Class name}}}
1815             \o  \image qtcreator-locator-classes.png
1816         \row
1817             \o  Go to a method definition.
1818             \o  \tt{\bold{m \e{Method name}}}
1819             \o  \image qtcreator-locator-methods.png
1820         \row
1821             \o  Execute a text editing macro.
1822             \o  \tt{\bold{rm \e{Macro name}}}
1823             \o  \image qtcreator-locator-macros.png
1824     \endtable
1825
1826     \section2 Creating Locator Filters
1827
1828     To quickly access files not directly mentioned in your project, you can
1829     create your own locator filters. That way you can locate files in a
1830     directory structure you have defined.
1831
1832     To create a locator filter:
1833
1834     \list 1
1835
1836         \o  In the locator, click \inlineimage qtcreator-locator-magnify.png
1837             and select \gui Configure. to open the \gui Locator options.
1838
1839             \image qtcreator-locator-customize.png
1840
1841         \o  Click \gui Add.
1842
1843         \o  In the \gui{Filter Configuration} dialog:
1844
1845         \list
1846
1847             \o  Name your filter.
1848
1849             \o  Select at least one directory. The locator searches directories
1850                 recursively.
1851
1852             \o  Define the file pattern as a comma separated list. For example,
1853                 to search all .h and .cpp files, enter \bold{*.h,*.cpp}
1854
1855             \o  Specify the prefix string.
1856
1857                 To show only results matching this filter, select
1858                 \gui{Limit to prefix}.
1859
1860                 \image qtcreator-navigate-customfilter.png
1861
1862         \endlist
1863
1864         \o Click OK.
1865
1866     \endlist
1867
1868     \section2 Adding Web Search Engines
1869
1870     You can use the \gui {Web Search (\c r)} locator filter to perform
1871     web searches. URLs and search commands for Bing, Google, Yahoo! Search,
1872     cplusplus.com, and Wikipedia are configured by default.
1873
1874     To find out the format of the search command to use for your favorite
1875     web search engine, perform a search in your browser and copy the resulting
1876     URL to the locator filter configuration. Replace the search term with the
1877     variable \c {%1}.
1878
1879     To add URLs and search commands to the list:
1880
1881     \list 1
1882
1883         \o  Select \gui {Tools > Options > Locator > Web Search (prefix: r) >
1884             Edit}.
1885
1886         \o  Select \gui Add to add a new entry to the list.
1887
1888             \image qtcreator-add-online-doc.png "Filter Configuration dialog"
1889
1890         \o  Double-click the new entry to specify a URL and a search command.
1891             For example, http://www.google.com/search?q=%1.
1892
1893         \o  Click \gui OK.
1894
1895     \endlist
1896
1897     \section2 Configuring the Locator Cache
1898
1899     The locator searches the files matching your file pattern in the
1900     directories you have selected and caches that information. The cache for
1901     all default filters is updated as you write your code. By default,
1902     \QC updates the filters created by you once an hour.
1903
1904     To update the cached information manually, click
1905     \inlineimage qtcreator-locator-magnify.png
1906     and select \gui Refresh.
1907
1908     To set a new cache update time:
1909
1910     \list 1
1911
1912         \o  Select \gui Tools > \gui Options > \gui Locator.
1913
1914         \o  In \gui{Refresh interval}, define new time in minutes.
1915
1916     \endlist
1917
1918 */
1919