creator-coding-edit-mode.qdoc 7.48 KB
Newer Older
1
2
/****************************************************************************
**
3
** Copyright (c) 2014 Digia Plc and/or its subsidiary(-ies).
hjk's avatar
hjk committed
4
** Contact: http://www.qt-project.org/legal
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
**
**
** GNU Free Documentation License
**
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of this
** file.
**
**
****************************************************************************/

// **********************************************************************
// 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.
// **********************************************************************

/*!
26
    \contentspage {Qt Creator Manual}
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
    \previouspage creator-editor-functions.html
    \page creator-coding-navigating.html
    \nextpage creator-highlighting.html

    \title Working in Edit Mode

    This section describes how to use the \gui Edit mode. For more information
    about using the sidebar, see \l{Browsing Project Contents}.

    \section1 Using the Editor Toolbar

    The editor toolbar is located at the top of the editor view. The editor
    toolbar is context sensitive and shows items relevant to the file currently
    open in the editor.

    \image qtcreator-editortoolbar-symbols.png

    Use the toolbar to navigate between open files and symbols in use.
45
    To browse backward or forward through your location history, click
46
    \inlineimage qtcreator-back.png
47
48
    (\gui {Go Back}) and \inlineimage qtcreator-forward.png
    (\gui {Go Forward}).
49

50
    To go to any open file, select it from the \gui{Open files} drop-down menu (1).
51
52
53
54
    Right-click the menu title and select \gui {Copy Full Path to Clipboard} to
    copy the path and name of the current file to the clipboard.

    To jump to any symbol used in the current file, select it from the
55
    \gui Symbols drop-down menu (2). By default, the symbols are displayed in the
56
57
58
59
    order in which they appear in the file. Right-click the menu title and
    select \gui {Sort Alphabetically} to arrange the symbols in alphabetic
    order.

60
61
62
63
64
65
66
67
68
69
70
71
72
    To jump to a line and column in the current file, select the line and column
    indicator (3) or press \key {Ctrl+L} (or \key {Cmd+L} on Mac OS X) to open
    the locator. Enter the line number and column number in the locator,
    separated by a colon (:).

    To show the file encoding of the current file on the editor toolbar (4),
    select \gui Tools > \gui Options > \gui {Text Editor} > \gui Display >
    \gui {Display file encoding}.

    \note Other convenient ways of navigating in \QC are provided by the
    \l{Searching with the Locator}{locator}, \l{Keyboard Shortcuts}
    {keyboard shortcuts}, and the \l{Browsing Project Contents}{sidebar}.

73
74
    \section1 Splitting the Editor View

75
76
    Split the editor view or open the editor in a new window when you want to
    work on and view multiple files on the same screen or on multiple screens.
77
78
79

    \image qtcreator-spliteditorview.png

80
    You can view multiple files simultaneously in the following ways:
81
82
83

    \list

84
        \li To split the editor view into a top and bottom view, select
85
86
87
            \gui Window > \gui Split, press \key{Ctrl+E, 2}, or select the
            \inlineimage qtcreator-split-button.png
            (\gui Split) button and then select \gui Split.
88
89
90

            Split command creates views below the currently active editor view.

91
        \li To split the editor view into adjacent views, select
92
93
            \gui Window > \gui{Split Side by Side}, press \key{Ctrl+E, 3}, or
            select \gui {Split > Split Side by Side}.
94
95
96
97

           Side by side split command creates views to the right of the
           currently active editor view.

98
99
100
101
102
103
104
        \li To open the editor in a detached window, press \key{Ctrl+E, 4}, or
            select \gui Window > \gui {Open in New Window}.

            The new window behaves basically in the same way as the editor area
            in the main window. For example, you can split this window, as well.
            Documents are opened in the currently active editor window.

105
106
    \endlist

107
108
    To move between split views and detached editor windows, select \gui Window
    > \gui{Go to Next Split or Window} or press \key{Ctrl+E, O}.
109
110

    To remove a split view, place the cursor within the view you want to
111
112
113
114
115
    remove and select \gui Window > \gui{Remove Current Split}, press
    \key{Ctrl+E, 0}, or select the
    \inlineimage qtcreator-remove-split-button.png
    (\gui {Remove Split}) button. To remove all but the currently selected split
    view,
116
117
118
119
    select \gui Window > \gui{Remove All Splits} or press \key{Ctrl+E, 1}.

    \section1 Using Bookmarks

120
121
122
123
    To insert or delete a bookmark:

    \list

124
        \li Right-click the line number and select \gui{Toggle Bookmark}.
125

126
        \li Press \key Shift and click the left margin at a line.
127

128
        \li Press \key{Ctrl+M} when the cursor is on a line.
129
130

    \endlist
131
132
133

    \image qtcreator-togglebookmark.png

134
135
136
137
    To add a note to a bookmark, right-click the bookmark and select
    \gui{Edit Bookmark Note}. To view the note, move the mouse pointer over the
    bookmark.

138
139
140
141
142
143
144
    To go to previous bookmark in the current session, press \key{Ctrl+,}.

    To go to next bookmark in the current session, press \key{Ctrl+.}.

    \section1 Moving to Symbol Definition or Declaration

    You can move directly to the definition or the declaration of a symbol by
145
    holding the \key Ctrl and clicking the symbol. If you have multiple splits
146
147
    opened, you can open the link in the next split by holding \key Ctrl and
    \key Alt while clicking on the symbol.
148
149
150
151
152
153

    To enable this moving function, in \gui Tools > \gui{Options} >
    \gui{Text Editor} > \gui Behavior, select \gui{Enable mouse navigation}.

    You can also select the symbol and press \key F2, or right-click the symbol
    and select \gui {Follow Symbol Under Cursor} to move to its definition or
154
    declaration. This feature is supported for namespaces, classes, functions,
155
    variables, include statements, and macros.
156

157
    To switch between the definition and declaration of a function, place the
158
    cursor on either and press \key {Shift+F2} or right-click and select \gui
159
160
    {Switch Between Function Declaration/Definition}. For example, this allows
    you to navigate from anywhere within a function body directly to the function
161
    declaration.
162

163
164
165
166
167
168
169
170
171
    Links are opened in the same split by default. To open links in the next
    split, prepend \key {Ctrl+E} to the shortcut. For example, press \key {Ctrl+E,F2}
    to follow the symbol in the next split. If necessary, the view is
    automatically split. To change the default behavior, select \gui Tools >
    \gui{Options} > \gui{Text Editor} > \gui Display, and then select
    \gui{Always Open Links in Next Split}. Additional symbols are displayed and
    switching between definition and declaration is done in another split.
    If you change the default behavior, the shortcuts for opening link targets
    in the next split are used to open them in the current split.
172

173
    \section1 Reparsing Externally Changed Files
174

175
176
177
178
    If source files are modified from outside \QC, the opened files will be
    reparsed automatically. For all other files, you can use \gui{Tools} >
    \gui{C++} > \gui{Reparse Externally Changed Files} to update the code
    model.
179
*/