OSDN Git Service

ece5321bb54a280684173d7b2a4991aa4009f5c8
[qt-creator-jp/qt-creator-jp.git] / doc / qtcreator.qdoc
1 /*!
2     \contentspage{index.html}{Qt Creator}
3     \page index.html
4     \nextpage creator-quick-tour.html
5
6     \title Qt Creator Manual
7
8     \section1 Version 1.2.1
9
10     The goal of Qt Creator is to provide a cross-platform, complete Integrated
11     Development Environment (IDE) to develop Qt projects. It is available for
12     the Linux, Mac OS X and Windows platforms.
13
14     \note Please report bugs and suggestions to the Qt task tracker at
15     http://qtsoftware.com/developer/task-tracker. You can also join the
16     qt-creator@trolltech.com mailing list. To subscribe, send a message with
17     the word \e subscribe to qt-creator-request@trolltech.com. For more
18     information on Qt mailing lists, visit http://lists.trolltech.com
19
20     \image qtcreator-screenshots.png
21
22     \table
23     \row
24         \o Qt Creator includes a wide range of useful features. Among them are:
25     \list 1
26         \o \bold{Smart Code Editor}: The code editor provides syntax
27             highlighting as well as code completion.
28         \o \bold{Qt4 Project Generating Wizard}: This wizard allows the user
29            to generate a project for a console application, a GUI application,
30            or a C++ library.
31         \o \bold{Qt Help Integration}: Qt's entire documentation can be
32            accessed easily by clicking on the \gui{Help} button.
33         \o \bold{Qt Designer Integration}: User interface forms can be designed
34            within Qt Creator. Simply double-click on a \c{.ui} file within the
35            \gui{Project Explorer} to launch the integration.
36         \o \bold{Locator}: A powerful navigation tool that lets the user locate
37            files and classes using minimal keystrokes.
38         \o \bold{Support for qmake's .pro file format}: The project's \c{.pro}
39            file is used as a project description file.
40         \o \bold{Debugging Interface}: Applications can be debugged
41            within Qt Creator using a graphical frontend to the GNU symbolic
42            debugger (GDB) and the Microsoft Console Debugger (CDB).
43     \endlist
44     \endtable
45
46     To learn more about the Qt Creator, click on one of the links below:
47
48     \list
49        \o   \l{A Quick Tour of Qt Creator}
50        \o   \l{Creating a Project in Qt Creator}
51        \o   \l{The Code Editor}
52        \o   \l{Build Settings}
53        \o   \l{Qt Version Management}
54        \o   \l{Writing a Simple Program with Qt Creator}
55        \o   \l{Qt Creator and Version Control Systems}
56        \o   \l{Navigating Quickly Around Your Code with Locator}
57        \o   \l{Debugging with Qt Creator}
58        \o   \l{CMake Support in Qt Creator}
59        \o   \l{Support for Generic Projects in Qt Creator}
60        \o   \l{Handling External Libraries}
61        \o   \l{Tips and Tricks}
62        \o   \l{Keyboard Shortcuts}
63        \o   \l{Glossary}
64        \o   \l{Supported Platforms}
65        \o   \l{Known Issues}
66        \o   \l{Acknowledgements}
67     \endlist
68
69 */
70
71
72 /*!
73     \contentspage index.html
74     \page creator-quick-tour.html
75     \nextpage creator-code-editor.html
76
77     \title A Quick Tour of Qt Creator
78
79     The labeled screenshot below shows some of the components of Qt Creator, in
80     \gui Edit mode.
81
82     \image qtcreator-breakdown.png
83
84     \section1 The Mode Selectors
85
86     When working in Qt Creator, you can be in one of six modes: \bold Welcome,
87     \bold Edit, \bold Debug, \bold Projects, \bold Help, and \bold Output.
88
89     Mode selectors allow you to quickly switch between tasks: Editing, browsing
90     the Qt Creator manual, setting up the build environment, etc. You can
91     activate a mode by either clicking on its mode selector, or using the
92     \l{keyboard-shortcuts}{corresponding shortcut}. Certain actions also
93     trigger a mode change, e.g., \gui{Debug}/\gui{Start Debugging} will switch
94     to the \gui Debug mode.
95
96     \list
97
98     \o \gui{Welcome Mode} - Displays a welcome screen allowing you to quickly
99     load recent sessions or individual projects. This is the mode you will see
100     if Qt Creator is run without command line switches.
101
102     \o \gui{Edit Mode} - Lets you edit both project and source files. A sidebar
103     on the left provides different views to navigate between files.
104
105     \o \gui{Debug Mode} - Provides various ways to inspect the state of the
106     program while debugging. See \l{Debugging With Qt Creator} for a hands-on
107     description of how to use this mode.
108
109     \o \gui{Projects Mode} - Lets you configure how projects can be built and
110     executed. Under the list of projects, there are tabs to configure the
111     build, run, and editor settings.
112
113     \o \gui{Help Mode} - Shows any documentation registered by Qt Assistant,
114     such as the Qt library and Qt Creator documentation.
115
116     \o \gui{Output Mode} - Lets you examine various data in detail, for example
117     build issues as well as compile and application output. This information
118     is also available in the output panes.
119
120     \endlist
121
122
123     \section1 The Output Panes
124
125     The task pane in Qt Creator can display one of four different panes:
126     \gui{Build Issues}, \gui{Search Results}, \gui{Application Output}, and
127     \gui{Compile Output}. These panes are available in all modes.
128
129
130     \section2 Build Issues
131
132     The {Build Issues} pane provides a list of issues, e.g., error messages or
133     warnings that need to be fixed. It filters out irrelevant output from the
134     compiler and collects them in an organized way.
135
136     \image qtcreator-build-issues.png
137
138
139     \section2 Search Results
140
141     The \gui{Search Results} pane displays the results for global searches such
142     as searching within a current document, files on disk, or all projects. In
143     the screenshot below, we searched for all occurrences of \c{textfinder}
144     within the \c{"/TextFinder"} folder.
145
146     \image qtcreator-search-pane.png
147
148
149     \section2 Application Output
150
151     The \gui{Application Output} pane displays the status of the program when
152     it is executed and debug output, e.g., output from qDebug().
153
154     \image qtcreator-application-output.png
155
156
157     \section2 Compile
158
159     The \gui{Compile Output} pane provides all the output from the compiler. In
160     other words, it is a more verbose version of information displayed in the
161     \gui{Build Issues}
162
163     \image qtcreator-compile-pane.png
164
165
166     \section1 Session Management in Qt Creator
167
168     In Qt Creator, a session is a collection of loaded projects, opened files,
169     editor settings, and so on. When you run Qt Creator, you have a default
170     session. You can create a new session using the \gui{Session Manager...}
171     option, available in the \gui{File -> Session} menu.
172
173
174     \image qtcreator-session-manager.png
175
176
177     To switch between sessions, select \gui{File -> Session}. If you do not
178     create and select any session, Qt Creator will always use the default
179     session.
180
181     \image qtcreator-session-menu.png
182
183
184     \section1 Qt Help Integration
185
186     Qt Creator comes fully integrated with all of Qt's documentation and
187     examples via the Qt Help plugin. To view the documentation, you can switch
188     to the \gui{Help} mode. To obtain context sensitive help, move your text
189     cursor to a Qt class or function and press \key{F1}. The documentation
190     will be displayed within a panel on the right, as shown in the screenshot
191     below.
192
193     External Documentation provided by the user can be used to augment or
194     replace the documentation shipped with Qt Creator and Qt.
195
196     \image qtcreator-context-sensitive-help.png
197
198
199     \section1 Qt Designer Integration
200
201     Qt Creator is fully integrated with Qt Designer to help you design user
202     interface forms just like you would with the standalone version. The Qt
203     Designer integration also includes project management and code completion.
204     For more information on Qt Designer, you can refer to
205     \l{http://doc.trolltech.com/designer-manual.html}{The Designer Manual}.
206
207     \image qtcreator-formedit.png
208
209
210     \section1 Keyboard Navigation
211
212     Qt Creator caters not only to developers who are used to using the mouse,
213     but also to developers who are more comfortable with the keyboard. A wide
214     range of \l{keyboard-shortcuts}{keyboard} and
215     \l{Navigating Quickly Around Your Code with Locator}{navigation} shortcuts
216     are available to help speed up the process of developing your application.
217 */
218
219 /*! \contentspage index.html
220     \previouspage creator-quick-tour.html
221     \page creator-code-editor.html
222     \nextpage creator-build-settings.html
223
224     \title The Code Editor
225
226     Qt Creator's code editor is designed to aid the developer to create, edit,
227     and navigate code. It is fully equipped with syntax highlighting, code
228     completion, context sensitive help, as well as inline error indicators
229     while you are typing. The screenshots below show the various dialogs within
230     which you can configure your editor.
231
232     \table
233         \row
234             \i  \inlineimage qtcreator-texteditor-fonts.png
235             \i  \inlineimage qtcreator-texteditor-behavior.png
236         \row
237             \i  \inlineimage qtcreator-texteditor-display.png
238             \i  \inlineimage qtcreator-texteditor-completion.png
239     \endtable
240
241     The table below lists keyboard shortcuts supported by the code editor.
242
243     \table
244         \row
245             \i  Block navigation
246             \i  To navigate between blocks, e.g., from one \bold{\{} to another
247                 \bold{\}} , use \key{Ctrl+[} and \key{Ctrl+]}.
248         \row
249             \i  Block selection
250             \i  To select a current block, use \key{Ctrl+U}. Pressing
251                 \key{Ctrl+U} again extends the selection to the parent block.
252                 To deselect, use \key{Ctrl+Shift+U}.
253         \row
254             \i  Moving lines up and down
255             \i  Use \key{Ctrl+Shift+Up} and \key{Ctrl+Shift+Down}
256
257         \row
258             \i  Completion
259             \i  Use \key{Ctrl+Space}
260
261         \row
262             \i  Indenting Blocks
263             \i  Use \key{Ctrl+I}
264
265         \row
266             \i  Collapse
267             \i  Use \key{Ctrl+\<}
268
269         \row
270             \i  Commenting or uncommenting blocks
271             \i  Use \key{Ctrl+\/}
272
273         \row
274             \i  Delete a line
275             \i  Use \key{Shift+Del}
276
277         \row
278             \i  Switch between header file and source file
279             \i  Use \key{F4}.
280
281         \row
282             \i  Increasing and decreasing font size
283             \i  Use \key{Ctrl+Scroll Wheel}
284
285         \row
286             \i  Follow symbols under the cursor
287             \i  Use \key{F2} and \key{Shift+F2}. This feature works with
288                 namespaces, classes, methods, variables, include statements,
289                 and macros.
290
291         \row
292             \i  Switch to an external editor
293             \i  Select \gui{Open in external editor} from the
294                 \gui{Edit -> Advanced} menu.
295     \endtable
296
297     \section1 Code Completion
298
299     The completion popup shows possible completions to a certain statement.
300     These completions include classes, namespaces, functions, variables,
301     macros and keywords. Listed below are the icons used in the completion box
302     and their meaning.
303
304     \table
305         \row
306             \i  \inlineimage completion/class.png
307             \i  A class
308         \row
309             \i  \inlineimage completion/enum.png
310             \i  An enum
311         \row
312             \i  \inlineimage completion/enumerator.png
313             \i  An enumerator (value of an enum)
314         \row
315             \i  \inlineimage completion/func.png
316             \i  A function
317         \row
318             \i  \inlineimage completion/func_priv.png
319             \i  A private function
320         \row
321             \i  \inlineimage completion/func_prot.png
322             \i  A protected function
323         \row
324             \i  \inlineimage completion/var.png
325             \i  A variable
326         \row
327             \i  \inlineimage completion/var_priv.png
328             \i  A private variable
329         \row
330             \i  \inlineimage completion/var_prot.png
331             \i  A protected variable
332         \row
333             \i  \inlineimage completion/signal.png
334             \i  A signal
335         \row
336             \i  \inlineimage completion/slot.png
337             \i  A slot
338         \row
339             \i  \inlineimage completion/slot_priv.png
340             \i  A private slot
341         \row
342             \i  \inlineimage completion/slot_prot.png
343             \i  A protected slot
344         \row
345             \i  \inlineimage completion/keyword.png
346             \i  A keyword
347         \row
348             \i  \inlineimage completion/macro.png
349             \i  A macro
350         \row
351             \i  \inlineimage completion/namespace.png
352             \i  A namespace
353     \endtable
354 */
355
356
357 /*!
358     \contentspage index.html
359     \previouspage creator-code-editor.html
360     \page creator-build-settings.html
361     \nextpage creator-version-management.html
362
363     \title Build Settings
364
365     \table
366         \row
367             \i  \note This page describes Qt Creator's support for \c qmake.
368                 For information on CMake support, see
369                 \l{CMake Support in Qt Creator}.
370     \endtable
371
372     To modify the build settings of your project, switch to the \gui{Projects}
373     mode using the mouse or with \key{Ctrl+4}.
374
375     \image qtcreator-buildsettingstab.png
376
377     Action items to create, clone, or delete build configurations can be found
378     at the bottom of the dialog. You can have as many build configurations as
379     needed. By default Qt Creator creates a \bold{debug} and \bold{release}
380     build configuration. Both these configurations use the
381     \l{glossary-default-qt}{Default Qt Version}.
382
383     In the tree on the left, a list of build configurations and their settings
384     are displayed. The screenshot above shows the \bold{debug} and
385     \bold{release} configurations and their corresponding settings:
386     \bold{Build Environment} and \bold{Build Steps}.
387
388     When you select a build configuration in the tree, a configuration page for
389     general build settings will be displayed. Here you can specify which
390     \l{glossary-project-qt}{Qt version} to use to build your project, whether
391     to \l{glossary-shadow-build}{shadow build} the project, for instance.
392
393     \image qtcreator-buildenvironment.png
394
395     In the \bold{Build Environment} page you can specify the environment used
396     for building. By default the environment in which Qt Creator was started
397     is used and modified to include the Qt version. Depending on the selected
398     Qt version, Qt Creator will automatically set the necessary environment
399     variables.
400
401     \image qtcreator-buildsteps.png
402
403     The build system of Qt Creator is built on top of \c qmake and \c make. The
404     settings for \c qmake and \c make can be changed in the
405     \bold{Build Settings} page. Qt Creator will run the make command using the
406     correct Qt version.
407
408     \section1 Dependencies
409
410     If you have multiple projects loaded in your session, you can configure
411     dependencies between them. This will affect the build order of your
412     projects. To do this, go the the \bold{Dependencies} tab after selecting
413     the project for which you want to configure the dependencies, and then use
414     the checkboxes to check which of the other projects is a dependency.
415
416 */
417
418
419 /*!
420     \contentspage index.html
421     \previouspage creator-build-settings.html
422     \page creator-version-management.html
423     \nextpage creator-creating-project.html
424
425     \title Qt Version Management
426
427     Qt Creator allows you to use multiple versions of Qt installed on your hard
428     disk and switch between them easily.
429
430     Qt Creator automatically detects if \c qmake is in the environment variable
431     \c PATH. This \l{glossary-system-qt}{version of Qt} is referred to as
432     \bold{Auto-detected Qt}. If you intend to use only one version of Qt - it is
433     already in your path and correctly set up for command line usage - you do
434     not need to manually configure your Qt version.
435
436     Otherwise, you can add your Qt version in
437     \gui{Tools -> Options... -> Qt Versions}. If you are on the Windows
438     platform and use MinGW to compile Qt, you need to tell Qt Creator where
439     MinGW is installed. This is done by setting the \gui{MinGW Directory}
440     under \gui{Tools -> Options... -> Qt4 -> Qt Versions -> MinGw Directory}.
441     If your Qt version is compiled with Microsoft Visual C++'s compiler, Qt
442     Creator will automatically set the correct environment variables for
443     compilation.
444
445     \note By default projects are compiled with the
446     \l{glossary-default-qt}{default Qt version}. You can override this in the
447     \gui{Build Configuration}.
448 */
449
450
451 /*!
452     \contentspage index.html
453     \previouspage creator-version-management.html
454     \page creator-creating-project.html
455     \nextpage creator-writing-program.html
456
457     \title Creating a Project in Qt Creator
458
459     \table
460         \row
461             \i \inlineimage qtcreator-new-project.png
462             \i \bold{Creating a New Project}
463
464         To create a new project, select \gui{New Project} from the \gui{File} menu.
465         You can create one of the following three projects:
466
467         \list
468             \o Qt4 Console Application
469             \o Qt4 Gui Application
470             \o C++ Library
471         \endlist
472
473         In this example, we select a \e{Qt4 Gui Application} and click \gui{OK}.
474
475         \row
476             \i \inlineimage qtcreator-intro-and-location.png
477             \i \bold{Setting the Project name and location}
478
479         Next, we set the project's name and its path. Click on the \gui{...}
480         button to browse and select your path.
481
482         Ideally, the path should not contain spaces or special characters.
483
484         \row
485             \i \inlineimage qtcreator-select-modules.png
486             \i \bold{Selecting The Necessary Qt Modules}
487
488         Click on the check boxes of each Qt Module you would like to include in
489         your project.
490
491         Since we started a Qt4 Gui Application, the Core and Gui modules are
492         set, but you are free to add more.
493
494         \row
495             \i \inlineimage qtcreator-class-info.png
496             \i \bold{Specifying Class Information}
497
498         Specify the name of the class you would like to create. The
499         \e{Header file}, \e{Source file} and \e{Form file} fields will update
500         automatically according to your choice of class name.
501
502         You also have to select the base class for your class, either a
503         QWidget, QDialog or QMainWindow,  from the drop down box.
504
505         \row
506             \i \inlineimage qtcreator-new-project-summary.png
507             \i \bold{Creating the Project}
508
509         Finally, review the files that will be created for you. Click
510         \gui{Done} and your project will be generated.
511
512     \endtable
513
514 */
515
516
517 /*!
518     \contentspage index.html
519     \previouspage creator-creating-project.html
520     \page creator-writing-program.html
521     \nextpage creator-version-control.html
522
523     \title Writing a Simple Program with Qt Creator
524
525     \table
526         \row
527         \o \note This tutorial assumes that the user has experience writing
528            basic Qt applications, designing user interfaces with Qt Designer
529            and using the Qt Resource System.
530     \endtable
531
532
533     In this example, we will describe the steps involve in using Qt Creator
534     to create a small Qt program, Text Finder. Inspired by the QtUiTools'
535     \l{http://doc.trolltech.com/uitools-textfinder.html}{Text Finder}
536     example, we will write a similar but simplified version of it, as shown
537     below.
538
539     \image qtcreator-textfinder-screenshot.png
540
541     \section1 Setting Up Your Environment
542
543     Once you have installed Qt Creator, it will automatically detect if Qt's
544     location is in your \c PATH variable. If Qt's location is not in your
545     \c PATH, you can set it in one of the following ways, depending on your
546     platform:
547
548     \list
549          \o On Windows and Linux: in the \gui{Tools} menu, under \gui{Options}.
550          \o On Mac OS X: in \gui{Preferences}, under \gui{Qt4}.
551     \endlist
552
553     \note If you use Visual Studio to compile Qt, all environment variables set
554     in Visual Studio will be set for Qt Creator as well.
555
556     \section1 Setting Up The Project
557
558     We begin with a Qt4 Gui Application project generated by Qt Creator. The
559     \l{Creating a Project in Qt Creator} document describes this process in
560     detail. Remember to select QWidget as the Text Finder's base class. If
561     your project is not yet loaded, you can load it by selecting \gui{Open}
562     from the \gui{File} menu.
563
564     In your project you will have the following files:
565
566     \list
567         \o \c{textfinder.h}
568         \o \c{textfinder.cpp}
569         \o \c{main.cpp}
570         \o \c{textfinder.ui}
571         \o \c{textfinder.pro}
572     \endlist
573
574     The \c{.h} and \c{.cpp} files come with the necessary boiler plate code;
575     the \c{.pro} file is also complete.
576
577     \section1 Filling In The Missing Pieces
578
579     We will begin by designing the user interface and then move on to filling
580     in the missing code. Finally, we will add the find functionality.
581
582     \section2 Designing the User Interface
583
584     To begin designing the user interface, double-click on the
585     \c{textfinder.ui} file in your \gui{Project Explorer}. This will launch the
586     integrated Qt Designer.
587
588     \image qtcreator-textfinder-ui.png
589
590     Design the form above using a \l{http://doc.trolltech.com/qlabel.html}
591     {QLabel}, \l{http://doc.trolltech.com/qlinedit.html}{QLineEdit} 
592     (named lineEdit), \l{http://doc.trolltech.com/qpushbutton.html}{QPushButton}
593     (named findButton), and a
594     \l{http://doc.trolltech.com/qtextedit.html}{QTextEdit} (named textEdit).
595     We recommend that
596     you use a QGridLayout to lay out the
597     \l{http://doc.trolltech.com/qlabel.html}{QLabel},
598     \l{http://doc.trolltech.com/qlinedit.html}{QLineEdit} and
599     \l{http://doc.trolltech.com/qpushbutton.html}{QPushButton}. The
600     \l{http://doc.trolltech.com/qtextedit.html}{QTextEdit} can then be added to
601     a \l{http://doc.trolltech.com/qvboxlayout.html}{QVBoxLayout}, along with
602     the \l{http://doc.trolltech.com/qgridlayout.html}{QGridLayout}. If you are
603     new to designing forms with \QD, you can take a look at the
604     \l{http://doc.trolltech.com/designer-manual.html}{Designer Manual}.
605
606     \section2 The Header File
607
608     The \c{textfinder.h} file already has the necessary includes, a
609     constructor, a destructor, and the \c{Ui} object. We need to add a private
610     slot, \c{on_findButton_clicked()}, to carry out our find operation. We
611     also need a private function, \c{loadTextFile()}, to read and display the
612     contents of our input text file in the
613     \l{http://doc.trolltech.com/qtextedit.html}{QTextEdit}. This is done with
614     the following code:
615
616     \snippet examples/textfinder/textfinder.h 0
617
618     \note The \c{Ui::TextFinder} object is already provided.
619
620     \section2 The Source File
621
622     Now that our header file is complete we move on to our source file,
623     \c{textfinder.cpp}.  We begin by filling in the functionality to load a
624     text file. The code snippet below describes this:
625
626     \snippet examples/textfinder/textfinder.cpp 0
627
628     Basically, we load a text file using
629     \l{http://doc.trolltech.com/qfile.html}{QFile}, read it with
630     \l{http://doc.trolltech.com/qtextstream.html}{QTextStream}, and
631     then display it on \c{textEdit} with
632     \l{http://doc.trolltech.com/qtextedit.html#plainText-prop}{setPlainText()}
633     which requires adding the following additional #includes to textfinder.cpp:
634
635     \snippet examples/textfinder/textfinder.cpp 1
636
637     For the \c{on_findButton_clicked()} slot, we extract the search string and
638     use the \l{http://doc.trolltech.com/qtextedit.html#find}{find()} function
639     to look for the search string within the text file. The code snippet below
640     further describes it:
641
642     \snippet examples/textfinder/textfinder.cpp 2
643
644     Once we have both these functions complete, we call \c{loadTextFile()} in
645     our constructor.
646
647     \snippet examples/textfinder/textfinder.cpp 3
648
649     The \c{on_findButton_clicked()} slot will be called automatically due to
650     this line of code:
651
652     \code
653     QMetaObject::connectSlotsByName(TextFinder);
654     \endcode
655
656     in the uic generated \c{ui_textfinder.h} file.
657
658     \section2 The Resource File
659
660     We require a resource file (\c{.qrc}) within which we will embed the input
661     text file. This can be any \c{.txt} file with a paragraph of text. To add
662     a resource file, right click on \gui{Resource Files} in the
663     \gui{Project Explorer} and select \gui{Add New File...}. You will see the
664     wizard dialog displayed below.
665
666     \image qtcreator-add-resource-wizard.png
667
668     Enter "textfinder" in the \gui{Name} field and use the given \gui{Path}.
669     Then, click \gui{Continue}.
670
671     \image qtcreator-add-resource-wizard2.png
672
673     On this page you can choose to which project you want to add the new file.
674     Make sure that \gui{Add to Project} is checked and
675     "TextFinder" is selected as the \gui{Project}, and click
676     \gui{Done}.
677
678     Your resource file will now be displayed with the Resource Editor. Click
679     on the \gui{Add} drop down box and select \gui{Add Prefix}. The prefix we
680     require is just a slash (\c{/}). Click \gui{Add} again but this time,
681     select \gui{Add File}. Locate the text file you are going to use, we use
682     \c{input.txt}.
683
684     \image qtcreator-add-resource.png
685
686     The screenshot above shows what you can expect to see once you have added
687     the resource file successfully.
688
689     \section1 Compiling and Running Your Program
690
691     Now that you have all the necessary files, you can compile your program by
692     clicking on the
693     \inlineimage qtcreator-run.png
694     button.
695
696 */
697
698 /*!
699     \contentspage index.html
700     \previouspage creator-writing-program.html
701     \page creator-version-control.html
702     \nextpage creator-navigation.html
703
704     \title Qt Creator and Version Control Systems
705
706     \table
707         \caption    Version control systems supported by Qt Creator
708         \row
709             \i  \bold{git}
710             \i  \l{http://git-scm.com/}
711             \i
712         \row
713             \i  \bold{Subversion}
714             \i  \l{http://subversion.tigris.org/}
715             \i
716         \row
717             \i  \bold{Perforce}
718             \i  \l{http://www.perforce.com}
719             \i  Server version 2006.1 and later
720     \endtable
721
722
723     \section1 Setup
724
725     Qt Creator uses the version control system's command line clients to
726     access your repositories. To set it up, you must ensure that these command
727     line clients can be located via the \c{PATH} environment variable. You can
728     specify the path to the command line client's executable in the settings
729     pages that can be found under \gui{Options...} in the \gui{Tools} menu.
730
731
732     \section1 Usage
733
734     You can find the version control menu entries in a sub-menu of the
735     \gui{Tools} menu. The version control system displayed here is the system
736     that manages the current project.
737
738     Each version control system adds a pane to the \gui{Application Output}
739     panes within which it will log the commands it executes, prepended by a
740     timestamp and the relevant output.
741
742     \image qtcreator-vcs-pane.png
743
744
745     \section2 Addings Files
746
747     When you create a new file or a new project, the wizards will display page
748     requesting whether the files should be added to a version control system.
749     This depends on whether the parent directory or the project is already
750     under version control and the system supports the concept of adding files,
751     e.g., \bold{Perforce} and \bold{Subversion}. Alternatively, you can also
752     add files later on using the version control tool menus.
753
754     With \bold{git}, there is no concept of adding files. Instead, all modified
755     files must be \e{staged} for a commit.
756
757
758     \section2 Viewing Diff Output
759
760     All version control systems provide menu options to \e{diff} the current
761     file or project - comparing with the latest version stored in the
762     repository and displaying the differences. In Qt Creator, a diff is
763     displayed in a read-only editor. If the file is accessible, you can double
764     -click on a selected diff chunk and Qt Creator will open an editor
765     displaying the file, scrolled to the line in question.
766
767     \image qtcreator-vcs-diff.png
768
769
770     \section2 Viewing Versioning History and Change Details
771
772     The versioning history of a file can be displayed by selecting the
773     \gui{Log} (for \bold{git}) or \gui{Filelog} (for \bold{Perforce} and
774     \bold{Subversion}) option. Typically, the log output will contain the
775     date, the commit message, and a change or revision identifier. If you
776     click on the identifier, a description of the change including the diff
777     will be displayed.
778
779     \image qtcreator-vcs-log.png
780     \image qtcreator-vcs-describe.png
781
782
783     \section2 Annotating Files
784
785     Annotation views are obtained by selecting \gui{Annotate} or \gui{Blame}.
786     This will display the lines of the file prepended by the change identifier
787     they originate from. Clicking on the change identifier shows a detailed
788     description of the file.
789
790
791     \section2 Committing Changes
792
793     Once you have finished making changes, you can submit them to the version
794     control system by choosing \gui{Commit} or \gui{Submit}. Qt Creator will
795     display a commit page containing a text editor, where you can enter your
796     commit message, and a checkable list of modified files to be included.
797     When you are done, click \gui{Commit} to start committing. In addition,
798     there is a \gui{Diff selected} button that brings up a diff view of the
799     files selected in the file list. Since the commit page is just another
800     editor, you can go back to it by closing the diff view. Alternatively, you
801     can view it from the editor combo box showing the \gui{Opened files}.
802
803     \image qtcreator-vcs-commit.png
804
805
806     \section2 Menu Entries Specific to git
807
808     The git sub-menu contains additional entries:
809
810     \table
811         \row
812             \i  \gui{Stash}
813             \i  Stash local changes prior to executing a \bold{pull}.
814         \row
815             \i  \gui{Pull}
816             \i  Pull changes from the remote repository. If there are locally
817                 modified files, you will be prompted to stash those changes.
818         \row
819             \i  \gui{Branches...}
820             \i  Displays the branch dialog showing the local branches at the
821                 top and remote branches at the bottom. To switch to the local
822                 branch, simply double-click on it. Double-clicking on a remote
823                 branch will first create a local branch with the same name that
824                 tracks the remote branch, and then switch to it.
825
826                 \image qtcreator-vcs-gitbranch.png
827     \endtable
828
829     \section2 Common options
830
831     The \gui{Version Control/Common} settings page features common settings for
832     version control systems, such as commit message line wrapping and checking
833     options.
834
835     \gui{Submit message checking script} is a script or program that can be
836     used to perform checks on the submit message before submitting. The submit
837     message is passed in as the script's first parameter. If there is an error,
838     the script should output a message on standard error and return a non-zero
839     exit code.
840
841     \gui{User/alias configuration file} takes a file in mailmap format that
842     lists user names and aliases. For example:
843
844     \code
845     Jon Doe <Jon.Doe@company.com>
846     Hans Mustermann <Hans.Mustermann@company.com> hm <info@company.com>
847     \endcode
848
849     Notice that the second line specifies the alias \e{hm} and the
850     corresponding email address for \e{Hans Mustermann}. If the user/alias
851     configuration file is present, the submit editor will display a context
852     menu with \gui{Insert name...} that will pop up a dialog letting the user
853     select a name.
854
855     \gui{User field configuration file} is a simple text file consisting of
856     lines specifying submit message fields that take user names, for example:
857
858     \code
859     Reviewed-by:
860     Signed-off-by:
861     \endcode
862
863     These fields will appear below the submit message. They provide completion
864     for the aliases/public user names specified in the
865     \e{User/alias configuration file} as well as a button that opens the
866     aforementioned user name dialog.
867
868 */
869
870
871 /*!
872     \contentspage index.html
873     \previouspage creator-version-control.html
874     \page creator-navigation.html
875     \nextpage creator-debugging.html
876
877     \title Navigating Quickly Around Your Code with Locator
878
879     With Qt Creator, navigating to different locations in your project or on
880     your disk, e.g., files, classes, methods, etc., is trivial using
881     \gui Locator -- a smart line edit at the bottom left of Qt Creator's
882     window.
883
884     \image qtcreator-locator.png
885
886     Suppose you would like to open your project's \c{main.cpp} file, click on
887     \gui Locator or use \key{Ctrl+K}, type in the file name and then press
888     \key Return. The file will be opened in the editor. You can also type
889     part of a file name and use the wildcard characters \c{*} and \c{?} to
890     match \e{any} number of \e{any} characters. A list of all files matching
891     your criteria will be displayed.
892
893     \gui Locator not only allows you to navigate files on disk but also other
894     "locations", which are organized with \bold{Filters}. Currently there are
895     filters for:
896
897     \list
898         \o  files anywhere on your hard disk (browsing through the file system),
899         \o  files from a subdirectory structure defined by you,
900         \o  files mentioned in your \c{.pro} files, such as source, header,
901             resource, and \c{.ui} files,
902         \o  any open document,
903         \o  class and method definitions in your project or anywhere referenced
904             from your project,
905         \o  help topics, including Qt's documentation, and,
906         \o  a specific line in the document displayed on your editor,
907     \endlist
908
909
910     Some of these filters require you to activate them by typing an assigned
911     \e prefix. This prefix is usually a single character followed by
912     \key{Space}. For example, to jump to the definition of the class
913     \l{http://doc.trolltech.com/qdatastream.html}{QDataStream}, type:
914     \key{Ctrl+K} to activate \gui Locator. Then type colon (\key{:}) followed
915     by \key{Space} and the class name.
916
917
918     Below is a full list of \l{http://doc.trolltech.com/qdatastream.html}
919     {QDataStream} related output:
920
921     \image qtcreator-navigate-popup.png
922
923
924     Filters can be added to provide quick navigation around files in a
925     subdirectory structure defined by you. This way, you can acccess files you
926     need, that are not directly mentioned in your project. Click on
927     \image qtcreator-locator-magnify.png
928      and choose \gui{Configure...} from the menu displayed.
929
930     \image qtcreator-locator-customize.png
931
932     This displays the \gui Preferences dialog (\gui Options on Mac Os X) for
933     navigation filters. Click \gui Add to create a new filter. In the
934     \gui{Filter Configuration} dialog below, give your filter a name, select
935     your preferred directories, set file patterns with a comma separated list,
936     and specify a prefix string.
937
938     \image qtcreator-navigate-customfilter.png
939
940     After closing this dialog, \gui Locator will search the directories you
941     selected for files matching your file patterns, and the information will be
942     cached. Click \gui Refresh from the menu above to update the cached
943     information.
944
945     The following table lists the filters currently available:
946
947     \table
948         \header
949             \o  Function
950             \o  Key Combination
951             \o  Screenshot
952         \row
953             \o  Go to a line in the current document
954             \o  Ctrl+K, l, Space, and the line number
955             \o  \image qtcreator-locator-line.png
956         \row
957             \o  Go to a symbol definition
958             \o  Ctrl+K, :, Space, and the function name
959             \o  \image qtcreator-locator-symbols.png
960         \row
961             \o  Go to a help topic
962             \o  Ctrl+K, ?, Space, and the topic
963             \o  \image qtcreator-locator-help.png
964         \row
965             \o  Go to an opened document
966             \o  Ctrl+K, o, Space, and the document name.
967             \o  \image qtcreator-locator-opendocs.png
968         \row
969             \o  Go to a file in the file system (browse the file system)
970             \o  Ctrl+K, f, Space, and the file name.
971             \o  \image qtcreator-locator-filesystem.png
972         \row
973             \o  Go to a file in any project currently loaded
974             \o  Ctrl+K, a, Space, and the function name.
975             \o  \image qtcreator-locator-files.png
976         \row
977             \o  Go to a file in the current project
978             \o  Ctrl+K, p, Space, and the function name.
979             \o  \image qtcreator-locator-current-project.png
980         \row
981             \o  Go to a class definition
982             \o  Ctrl+K, c, Space, and the class name.
983             \o  \image qtcreator-locator-classes.png
984         \row
985             \o  Go to a method definition
986             \o  Ctrl+K, m, Space, and the class name.
987             \o  \image qtcreator-locator-methods.png
988     \endtable
989
990     \note By default, if you press \key{Ctrl+K} and do not use a prefix to
991     specify a filter, three filters will be enabled: \c{o}, \c{l}, and \c{a}.
992
993 */
994
995
996 /*!
997     \contentspage index.html
998     \previouspage creator-navigation.html
999     \page creator-debugging.html
1000     \nextpage creator-cmake-support.html
1001
1002     \title Debugging with Qt Creator
1003
1004
1005     \section1 Introduction
1006
1007     Qt Creator does not have its own debugger. Instead, it provides a graphical
1008     frontend to various debugger engines:
1009
1010     \table
1011         \header
1012             \o Platform
1013             \o Compiler
1014             \o Debugger Engine
1015         \row
1016             \o Linux, Unixes, Mac OS
1017             \o gcc
1018             \o GNU Symbolic Debugger (gdb)
1019         \row
1020             \o Windows/MinGW
1021             \o gcc
1022             \o GNU Symbolic Debugger (gdb)
1023         \row
1024             \o Windows
1025             \o Microsoft Visual C++ Compiler
1026             \o Debugging Tools for Windows/Microsoft Console Debugger (CDB)
1027     \endtable
1028
1029     The frontend allows you to
1030     step through a program line-by-line or instruction-by-instruction,
1031     interrupt running programs, set breakpoints, examine the contents of the
1032     call stack, local and global variables, etc.
1033
1034     Within Qt Creator, the raw information provided by the engine is displayed
1035     in a clear and concise manner, simplifying the process of debugging.
1036
1037     In addition to generic IDE functionality: stack view, views for locals and
1038     watchers, registers, etc, Qt Creator comes with additional features to make
1039     debugging Qt-based applications easy. The debugger frontend knows about the
1040     internal layout of several Qt classes such as QString, the QTL containers,
1041     and most importantly QObject (and classes derived from it). Therefore, it
1042     is able to present Qt's data clearly.
1043
1044
1045     \section1 Debugger Engine Installation Notes
1046
1047     \table
1048         \header
1049             \o Debugger Engine
1050             \o Notes
1051         \row
1052             \o Gdb
1053             \o Requires gdb version 6.8.
1054         \row
1055             \o Debugging Tools for Windows
1056             \o Using this engine requires you to install the
1057                \e{Debugging Tools for Windows}
1058                \l{http://www.microsoft.com/whdc/devtools/debugging/installx86.Mspx}{32-bit}
1059                or
1060                \l{http://www.microsoft.com/whdc/devtools/debugging/install64bit.Mspx}{64-bit}
1061                package (Version 6.10 for the 32-bit or the 64-bit version of Qt Creator, respectively),
1062                which is freely available for download from the
1063                \l{http://msdn.microsoft.com/en-us/default.aspx}
1064                {Microsoft Developer Network}.
1065
1066                The pre-built \e{Qt SDK for Windows} will make use
1067                of the library if it is present on the system. When building Qt
1068                Creator using the Microsoft Visual C++ Compiler, the
1069                \c{"%ProgramFiles%\Debugging Tools for Windows"} path will be
1070                checked to ensure that all required header files are there.
1071     \endtable
1072
1073
1074     \section1 Interacting with the Debugger
1075
1076     In \gui Debug mode, several dock widgets are used to interact with the
1077     program you are debugging. The frequently used dock widgets are visible by
1078     default; the rarely used ones are hidden. To change the default settings,
1079     select \gui Debug and then select \gui View.
1080
1081     \image qtcreator-debug-view.png
1082
1083     Here, you can lock or unlock the location of your views as well as display
1084     or hide them. Among the views you can display are \gui Breakpoints,
1085     \gui Disassembler, \gui Modules, \gui Registers, \gui Debugger, \gui Stack, and
1086     \gui Thread. The position of your dock widgets will be saved for future
1087     sessions.
1088
1089
1090     \section2 Breakpoints
1091
1092     Breakpoints are shown in the \gui{Breakpoints} view which is enabled by
1093     by default. This view is also accessible when the debugger and the program
1094     being debugged is not running.
1095
1096     A breakpoint represents a position or sets of positions in the code that,
1097     when executed, interrupts the program being debugged and passing the
1098     control to the user. The user is then free to examine the state of the
1099     interrupted program, or continue execution line-by-line or continuously.
1100
1101     Typically, breakpoints are associated with a source code file and line, or
1102     the start of a function -- both allowed in Qt Creator.
1103
1104     Also, the interruption of a program by a breakpoint can be restricted with
1105     certain conditions.
1106
1107     You can set a breakpoint:
1108
1109     \list
1110        \o At a particular line you want the program to stop -- click on the
1111           left margin or press \key F9 (\key F8 for Mac OS X).
1112        \o At a function that you want the program to interrupt -- enter the
1113           function's name in \gui{Set Breakpoint at Function...} under the
1114           \gui Debug menu.
1115     \endlist
1116
1117     You can remove a breakpoint:
1118
1119     \list
1120         \o By clicking on the breakpoint marker in the text editor.
1121         \o By selecting the breakpoint in the breakpoint view and pressing
1122            \key{Delete}.
1123         \o By selecting \gui{Delete Breakpoint} from the breakpoint's context
1124            menu in the \gui Breakpoints view.
1125     \endlist
1126
1127     Breakpoints can be set and deleted before the program has actually started
1128     running or while it is running under the debugger's control. Also,
1129     breakpoints are saved together with a session.
1130
1131
1132     \section2 Running
1133
1134     To start a program under the debugger's control, select the \gui{Debug}
1135     menu and \gui{Start Debugging}, or simply press \key{F5}. Qt Creator then
1136     checks whether the compiled program is up-to-date, rebuilding it if
1137     necessary. The debugger then takes over and starts the program.
1138
1139     \note Starting a program in the debugger can take considerable amount of
1140     time, typically in the range of several seconds to minutes if complex
1141     features (like QtWebKit) are used.
1142
1143     Once the program starts running, it behaves as usual; performance-wise as
1144     well. The user can interrupt a running program by selecting
1145     \gui {Interrupt} from the \gui{Debug} menu. The program is automatically
1146     interrupted as soon as a breakpoint is hit.
1147
1148     Once the program stops, Qt Creator:
1149
1150     \list
1151         \o Retrieves data representing the call stack at the program's current
1152            position.
1153         \o Retrieves the contents of local variables.
1154         \o Examines \gui Watchers.
1155         \o Updates the \gui Registers, \gui Modules, and \gui Disassembler
1156            views.
1157     \endlist
1158
1159
1160     You can use the debugger views to examine the data in more detail.
1161
1162     To finish debugging, Press \key{Shift+F5}. A line of code can be executed
1163     as a whole with \key F10; to execute a function or a sub-function, use
1164     \key F11. Alternatively, you can continue running the program with \key F5.
1165     It is possible to continue executing your program until the current
1166     function completes or jump to an arbitrary position in the current
1167     function.
1168
1169
1170     \section2 Stack
1171
1172     When the program being debugged is interrupted, Qt Creator displays the
1173     nested function calls leading to the current position as a \e call stack
1174     trace. This stack trace is built up from \e{call stack frames}, each
1175     representing a particular function. For each function, Qt Creator will try
1176     to retrieve the file name and line number of the corresponding source
1177     files. This data is shown in the \gui Stack view.
1178
1179     \image qtcreator-debug-stack.png
1180
1181     Since the call stack leading to the current position may originate or go
1182     through code for which no debug information is available, not all stack
1183     frames will have corresponding source locations. These frames will be
1184     grayed out in the \gui Stack view.
1185
1186     If you click on a frame with a known source location, the text editor will
1187     jump to the corresponding location and update the \gui{Locals and Watchers}
1188     view, making it seem like the program was interrupted before entering the
1189     function.
1190
1191
1192     \section2 Threads
1193
1194     If a multi-threaded program is interrupted, the \gui Thread view  or the
1195     combobox named \gui Thread in the debugger's status bar can be used to
1196     switch from one thread to another. The \gui Stack view will adjust itself
1197     accordingly.
1198
1199
1200     \section2 Locals and Watchers
1201
1202     Whenever a program stops under the control of the debugger, it retrieves
1203     information about the topmost stack frame and displays it in the
1204     \gui{Locals and Watchers} view. This typically includes information about
1205     parameters of the function in that frame as well as the local variables.
1206
1207     Compound variables of struct or class type will be displayed as
1208     "expandable" in the view. C lick on the "+" to expand the entry and show
1209     all members. Together with the display of value and type, the user can
1210     examine and traverse the low-level layout of an object's data.
1211
1212
1213     \table
1214         \row
1215             \i  \bold{Note:}
1216
1217         \row
1218             \i  Gdb, and therefore Qt Creator's debugger works for optimized
1219                 builds on Linux and Mac OS X. However, optimization may lead
1220                 to re-ordering of instructions or sometimes even complete
1221                 removal of some local variables. In this case, the
1222                 \gui{Locals and Watchers} view may show unexpected data.
1223
1224         \row
1225             \i  The debug information provided by gcc does not include enough
1226                 information about the time when a variable is initialized.
1227                 Therefore, Qt Creator can not tell whether the contents of a
1228                 local variable contains "real data", or "initial noise". If a
1229                 QObject appears uninitialized, its value will be reported as
1230                 "out of scope". However, not all uninitialized objects can be
1231                 recognized as such.
1232     \endtable
1233
1234
1235     The \gui{Locals and Watchers} view also provides access to the most
1236     powerful feature of the debugger: comprehensive display of data belonging
1237     to Qt's basic objects. To enable this feature, select \gui{Use Custom
1238     Display for Qt Objects} from the \gui Debug menu.The
1239     \gui{Locals and Watchers} view will be re-organized to provide a high-level
1240     view of the objects. For example, in case of QObject, instead of displaying
1241     a pointer to some private data structure, you will see a list of children,
1242     signals and slots.
1243
1244     Similarly, instead of displaying many pointers and integers, Qt Creator's
1245     debugger will display the contents of a QHash or QMap in an orderly manner.
1246     Also, the debugger will display access data for QFileInfo and provide
1247     access to the "real" contents of QVariant.
1248
1249     The \gui{Locals and Watchers} view can be used to change the contents of
1250     variables of simple data types such as \c int or \c float when the program
1251     is interrupted. To do so, click on the \gui Value column, modify the value
1252     with the inplace editor, and hit \key Enter (or \key Return).
1253
1254     \note The set of watched items is saved within your session.
1255
1256
1257     \section2 Modules
1258
1259     By default, the \gui Modules view is hidden as it is only useful with the
1260     experimental delayed loaing of debug information feature. You can turn
1261     this feature on by selecting \gui{Fast Debugger Start}
1262
1263
1264     With this feature, debug information from the Qt library itself is not
1265     loaded when the application starts up, thereby reducing the startup times
1266     for some applications. You can then use the \gui Modules view to manually
1267     load this information, if required.
1268
1269     \note In this scenario, some breakpoints may not be triggered by the
1270     debugger.
1271
1272
1273     \section2 Disassembler View and Registers View
1274
1275     By default, both the \gui Disassembler and \gui Registers view are hidden.
1276     The \gui Disassembler view displays disassembled code for the current
1277     function; the \gui Registers view displays the current state of the CPU's
1278     registers. Both views are useful for low-level commands such as
1279     \gui{Step Single Instruction} and \gui{Step Over Single Instruction}.
1280
1281     \section1 Debugging Helper Library
1282
1283     While debugging Qt Creator dynamically loads a helper library into your
1284     program. This helper library enables Qt Creator to pretty print Qt and STL
1285     types. The Qt SDK package already contains a prebuilt debugging helper
1286     library. To create a debugging helper library, select the \gui{Options}
1287     from the \gui{Tools} menu, and go to the \gui{Qt/Qt Versions} pane. As the
1288     internal layout of qt can change between versions, the debugging helper
1289     library is built for each Qt version.
1290
1291
1292     \section1 A Walkthrough for the Debugger Frontend
1293
1294     In our \l{Writing a Simple Program with Qt Creator}{TextFinder} example, we
1295     read a text file into a QString and then display it with a QTextEdit.
1296     Suppose, you would like to look at this QString, \c{line}, and see what
1297     data it actually stores. Follow the steps described below to place a
1298     breakpoint and view the QString object's data.
1299
1300     \table
1301         \row
1302             \i \inlineimage qtcreator-setting-breakpoint1.png
1303             \i \bold{Setting a Breakpoint}
1304
1305     First, we set a breakpoint on the line where we invoke
1306     \l{http://doc.trolltech.com/qtextedit.html#plainText-prop}{setPlainText()}
1307     by clicking between the line number and the window border. Then, select
1308     \gui{Start Debugging} from the \gui{Debug} menu or press \key{F5}.
1309     \endtable
1310
1311     Breakpoints are visible in the \gui{Breakpoints} view, shown below, in
1312     \gui{Debug} mode. If you wish to remove a breakpoint, simply right-click on
1313     it and select \gui{Delete breakpoint} from the context menu.
1314
1315     \image qtcreator-setting-breakpoint2.png
1316
1317     To view the contents of \c{line}, take a look at the \gui{Locals and
1318     Watchers} view.
1319
1320     \image qtcreator-watcher.png
1321
1322     Suppose we modify our \c{on_findButton_clicked()} function to move back to
1323     the start of the document and continue searching once the cursor hits the
1324     end of the document. Adding this functionality can be done with the code
1325     snippet below:
1326
1327     \code
1328     void TextFinder::on_findButton_clicked()
1329     {
1330         QString searchString = ui->lineEdit->text();
1331
1332         QTextDocument *document = ui->textEdit->document();
1333         QTextCursor cursor = ui->textEdit->textCursor();
1334         cursor = document->find(searchString, cursor,
1335             QTextDocument::FindWholeWords);
1336         ui->textEdit->setTextCursor(cursor);
1337
1338         bool found = cursor.isNull();
1339
1340         if (!found && previouslyFound) {
1341             int ret = QMessageBox::question(this, tr("End of Document"),
1342             tr("I have reached the end of the document. Would you like "
1343             "me to start searching from the beginning of the document?"),
1344             QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
1345
1346             if (ret == QMessageBox::Yes) {
1347                 cursor = document->find(searchString,
1348                     QTextDocument::FindWholeWords);
1349                 ui->textEdit->setTextCursor(cursor);
1350             } else
1351                 return;
1352         }
1353         previouslyFound = found;
1354     }
1355     \endcode
1356
1357     However, if you compile and run this code, the application will not work
1358     correctly due to a logic error. To locate this logic error, you can step
1359     through the code using the following buttons:
1360
1361     \image qtcreator-debugging-buttons.png
1362
1363 */
1364
1365
1366 /*!
1367
1368     \contentspage index.html
1369     \previouspage creator-debugging.html
1370     \page creator-cmake-support.html
1371     \nextpage creator-generic-projects.html
1372
1373     \title CMake Support in Qt Creator
1374
1375     Since Qt Creator 1.1, support for \c CMake project files is available.
1376
1377
1378     \section1 Opening CMake Projects
1379
1380     To open a \c CMake project select \gui Open from the \gui File menu and
1381     select the \c{CMakeLists.txt} file from your \c CMake project. A wizard
1382     will guide you with the rest of the process. If the \c CMake project does
1383     not have an in-place build, Qt Creator lets you specify the directory in
1384     which the project is built (shadow build).
1385
1386     \image qtcreator-cmake-import-wizard1.png
1387
1388     The screenshot below shows how you can specify command line arguments to
1389     \c CMake for your project.
1390
1391     \image qtcreator-cmake-import-wizard2.png
1392
1393     Normally, there is no need to pass any command line arguments for projects
1394     that are already built, as \c CMake caches that information.
1395
1396
1397     \section1 Building CMake Projects
1398
1399     Qt Creator builds \c CMake Projects by running \c make or \c mingw32-make,
1400     depending on your platform. The build errors and warnings are parsed and
1401     displayed in the \gui{Build Issues} output pane.
1402
1403     By default Qt Creator builds the \e{all} target. You can specify which
1404     targets to build in \gui{Project} mode, under \gui{Build Settings}.
1405
1406     \image qtcreator-cmake-build-settings.png
1407
1408     Qt Creator supports multiple build configurations. Also, the build
1409     directory can be modified after the initial import.
1410
1411
1412     \section1 Running CMake Projects
1413     Qt Creator automatically adds \gui{Run Configurations} for all targets
1414     specified in the \c CMake project file.
1415
1416     Known issues for the current version can be found
1417     \l{Known Issues of Version 1.1.0}{here}.
1418 */
1419
1420
1421 /*!
1422     \contentspage index.html
1423     \previouspage creator-cmake-support.html
1424     \page creator-generic-projects.html
1425     \nextpage creator-external-library-handling.html
1426
1427     \title Support for Generic Projects in Qt Creator
1428
1429     Since Qt Creator 1.1, generic projects are supported, in addition to
1430     \c qmake projects. In other words, you can import existing projects that
1431     do not use \c qmake or \c CMake and Qt Creator will simply ignore your
1432     build system.
1433
1434     This feature lets you use Qt Creator as a code editor. You can change the
1435     way your project is built by modifying the \c make command on the
1436     \gui{Project Settings} page.
1437
1438     Since Qt Creator has no way of knowing which files belong to your project,
1439     or which include directories and defines you're passing to your compiler,
1440     the generic project allows you to specify this information manually.
1441
1442     \section1 Specifying which files belong to your project
1443
1444     The list of files belonging to a generic project is specified in the
1445     \c{.files} file. Qt Creator adds any files that it recognizes when you
1446     first create the generic project. If you want to add additional files, or
1447     need to add/remove files later, edit the .files file in Qt Creator. Your
1448     project tree will be refreshed on saving this file.
1449
1450     If you frequently need to update this file, for example after updating
1451     from a source control system, you may want to write a small script that
1452     updates the file for you. At the moment Qt Creator needs to be restarted
1453     when the file is modified externally, in order to pick up the changes.
1454
1455     \section1 Specifying the include paths
1456
1457     The include paths are specified in the \c{.includes} file.
1458
1459     \section1 Specifying the defines
1460
1461     The defines are specified in the \c{.config} file. This is basically a
1462     regular C++ file that is prepended to all your source files when they are
1463     being parsed, but you should generally only use it to add lines like the
1464     following:
1465
1466     #define NAME value
1467
1468     \section1 Creating a run configuration
1469
1470     Qt Creator can't automatically determine which executable it should run.
1471     Hence, set up a custom executable run configuration in the Projects mode,
1472     using the + button. Specify the name, executable, optionally some
1473     arguments. The working directory is $BUILDDIR by default, which should
1474     generally work fine.
1475
1476 */
1477
1478
1479 /*!
1480     \contentspage index.html
1481     \previouspage creator-generic-projects.html
1482     \page creator-external-library-handling.html
1483     \nextpage creator-tips.html
1484
1485     \title Handling External Libraries
1486
1487     The ability to recognize external libraries is not only important for the
1488     underlying buidl system, but also for Qt Creator itself. This ability
1489     allows Qt Creator to support code completion and syntax highlighting for
1490     external libraries as if they were part of the current project or the Qt
1491     library.
1492
1493     The procedure of adding a library to a project, depends on the type of
1494     project, which influences the build system used. The following sections
1495     describe the the procedure required for each project type.
1496     
1497
1498     \section1 QMake Projects (the default)
1499
1500     Open your project file (\c{.pro}) from the \gui{Projects} pane. Then,
1501     follow the guidelines in the
1502     \l{http://doc.trolltech.com/latest/make-project-files.html#declaring-other-libraries}
1503     {Declaring other Libraries} section of the Qt documentation.
1504
1505     If your project successfully builds and links against the external library,
1506     syntax completion and highlighting should also work.
1507     
1508
1509     \section1 CMake Projects
1510
1511     In CMake, libraries are usually detected using the \c{FIND_PACKAGE()} macro.
1512     A couple of them are already being shipped with CMake, they can be found in
1513     the \c{Modules} directory of your CMake installation. If you provide 
1514     libraries on your own, you will need to provide your own \c{FindFoo.cmake}
1515     file. Refer to the \l{http://vtk.org/Wiki/CMake_FAQ#Writing_FindXXX.cmake_files}
1516     {CMake FAQ} for details.
1517     
1518     As with qmake project, syntax completion and highlighting should work if 
1519     you can sucessfully build and link against the external library.
1520     
1521     \section1 Generic Projects
1522
1523     If you import a project using the \e{Generic Projects} function, Qt Creator will
1524     create a file called \c{<projectname>.includes} in your project root directory. It will
1525     contain all project subdirectories it that was able to find relevant header files in. 
1526     Simply add your include pathes there. 
1527     
1528     Note that in Generic Project mode, Qt Creator will refrain from touching any
1529     project settings, so the above is merely a hint for the code completion and
1530     the syntax highlighter.
1531 */
1532
1533
1534 /*!
1535     \contentspage index.html
1536     \previouspage creator-external-library-handling.html
1537     \page creator-tips.html
1538     \nextpage creator-keyboard-shortcuts.html
1539
1540     \title Tips and Tricks
1541
1542     \bold{Quickly Switching between Modes}
1543
1544     You can quickly switch between modes by pressing \key{Ctrl+1},
1545     \key{Ctrl+2}, and so on.
1546
1547     \bold{Keyboard Shortcuts}
1548
1549     Qt Creator provides a lot of useful keyboard shortcuts. Some useful
1550     shortcuts can be found \l{Keyboard Shortcuts}{here}.
1551
1552     \bold{Running Qt Creator from the Command Line}
1553
1554     You can start Qt Creator from a command prompt with the name of an existing
1555     session or \c{.pro} file by giving the name as argument on the command
1556     line.
1557
1558     \bold{Show and Hide the Sidebar}
1559
1560     You can show and hide the the sidebar in \gui Edit and \gui Debug mode by
1561     clicking on the corresponding icon, or by pressing \key{Alt+0}.
1562
1563     \bold{Display Signals and Slots}
1564
1565     If you have an instance of a class that is derived from QObject, and you
1566     would like to find all other objects connected to one of your object's
1567     slots using Qt's signals and slots mechanism -- you can enable
1568     \gui{Use Custom Display for Qt Objects} feature under the \gui Debug menu.
1569
1570     In the \gui{Locals and Watchers} view, expand the object's entry and open
1571     the slot in the \e slots subitem. The objects connected to this slot are
1572     exposed as children of the slot. This method works with signals too.
1573
1574     \bold{Display Low Level Data}
1575
1576     If special debugging of Qt objects fails due to data corruption within the
1577     debugged objects, you can switch the debugging helpers off in the
1578     \gui{Debugger -> Debugging Helper} options dialog.
1579     This will make the low-level structures visible again.
1580 */
1581
1582
1583 /*!
1584     \contentspage index.html
1585     \previouspage creator-tips.html
1586     \page creator-keyboard-shortcuts.html
1587     \nextpage creator-glossary.html
1588
1589     \title Keyboard Shortcuts
1590
1591     Qt Creator provides various keyboard shortcuts to aid in the development
1592     process. These shortcuts are listed in the table below:
1593
1594     \table
1595         \header
1596             \o Function
1597             \o Key Combination
1598
1599         \row
1600             \o Activate \gui Welcome mode
1601             \o Ctrl + 1
1602         \row
1603             \o Activate \gui Edit mode
1604             \o Ctrl + 2
1605         \row
1606             \o Activate \gui Debug mode
1607             \o Ctrl + 3
1608         \row
1609             \o Activate \gui Projects mode
1610             \o Ctrl + 4
1611         \row
1612             \o Activate \gui Help mode
1613             \o Ctrl + 5
1614         \row
1615             \o Activate \gui Output mode
1616             \o Ctrl + 6
1617         \row
1618             \o Find
1619             \o Ctrl + F
1620         \row
1621             \o Find next
1622             \o F3
1623         \row
1624             \o Go back to the code editor (\gui Edit mode: The first press
1625                gives the editor focus, without closing secondary windows; the
1626                second press closes all secondary windows. \gui Debug mode or
1627                \gui Help mode: Switch to \gui Edit mode.)
1628             \o Esc
1629         \row
1630             \o Go to a line
1631             \o Ctrl + L
1632         \row
1633             \o Navigate between pages
1634             \o Alt + Left, Alt + Right
1635         \row
1636             \o Start debugging
1637             \o F5
1638         \row
1639             \o Stop debugging
1640             \o Shift + F5
1641         \row
1642             \o Toggle code declaration and definition
1643             \o F2
1644         \row
1645             \o Toggle header file and source file
1646             \o F4
1647         \row
1648             \o Toggle Side Bar
1649             \o Alt + 0
1650         \row
1651             \o Toggle \gui{Build Issues} pane
1652             \o Alt + 1
1653         \row
1654             \o Toggle \gui{Search Results} pane
1655             \o Alt + 2
1656         \row
1657             \o Toggle \gui{Application Output} pane
1658             \o Alt + 3
1659         \row
1660             \o Toggle \gui{Compile Output} pane
1661             \o Alt + 4
1662     \endtable
1663 */
1664
1665
1666 /*!
1667     \contentspage index.html
1668     \previouspage creator-keyboard-shortcuts.html
1669     \page creator-glossary.html
1670     \nextpage creator-supported-platforms.html
1671
1672     \title Glossary
1673
1674     \table
1675         \header
1676             \o  Term
1677             \o  Meaning
1678
1679         \row
1680             \o
1681                 \raw HTML
1682                 Auto-detected&nbsp;Qt
1683                 \endraw
1684                 \target glossary-system-qt
1685             \o  The version of Qt installed on your system. This is the Qt
1686                 version for the \c qmake command found in your \c PATH.
1687
1688         \row
1689             \o
1690                 \raw HTML
1691                 Default&nbsp;Qt
1692                 \endraw
1693                 \target glossary-default-qt
1694             \o  The version of Qt configured in \gui{Tools -> Options -> Qt 4
1695                 -> Default Qt Version}. This is the Qt version used by your
1696                 new projects. It defaults to the Auto-detected&nbsp;Qt.
1697
1698         \row
1699             \o
1700                 \raw HTML
1701                 Project&nbsp;Qt
1702                 \endraw
1703                 \target glossary-project-qt
1704             \o  The version of Qt configured in \gui{Build&Run -> Build
1705                 Settings -> Build Configurations}. This is the Qt version that
1706                 is actually used by a particular project. It defaults to
1707                 Default Qt.
1708
1709         \row
1710             \o
1711                 \raw HTML
1712                 Shadow&nbsp;Build
1713                 \endraw
1714                 \target glossary-shadow-build
1715             \o  Shadow building means building a project in a separate
1716                 directory, the \e{build directory}. The build directory is
1717                 different from the source directory. One of the benefits of
1718                 shadow building is that it keeps your source directory clean.
1719                 Shadow building is the best practice if you need many build
1720                 configurations for a single set of source.
1721     \endtable
1722
1723 */
1724
1725
1726 /*!
1727     \contentspage index.html
1728     \previouspage creator-glossary.html
1729     \page creator-supported-platforms.html
1730     \nextpage creator-known-issues.html
1731
1732     \title Supported Platforms
1733
1734     Qt Creator is available in binary packages for the following platforms:
1735
1736     \list
1737         \o  Windows XP Service Pack 2
1738         \o  Windows Vista
1739         \o  (K)Ubuntu Linux 5.04
1740         \o  (K)Ubuntu Linux 7.04 32bit and 64 bit
1741         \o  Mac OS 10.4 and later
1742     \endlist
1743
1744     \note Building the sources requires \bold{Qt 4.5.0} or later.
1745 */
1746
1747
1748 /*!
1749     \contentspage index.html
1750     \previouspage creator-supported-platforms.html
1751     \page creator-known-issues.html
1752     \nextpage creator-acknowledgements.html
1753
1754     \title Known Issues
1755
1756     There are some known issues with Qt Creator.
1757     The development team is aware of those, there is no need to report them as bug.
1758
1759     \section1 Known Issues of Version 1.2.1
1760
1761     \list
1762         \o Gdb on Windows may not work if the 'Embassy \reg Security Center' software
1763            by 'Wave \reg Systems' is installed and active (causing crashes in \c{vxvault.dll)}).
1764
1765         \o Only simple data types (POD) work in the Watch Window of CDB.
1766
1767         \o Qt Creator uses SQLite for storing some of its settings. SQLite is
1768            known to have problems with certain NFS servers (most notably the
1769            nfs-user-server 2.2beta), since they can lock up the application
1770            when it tries to lock the database. If your home directory is on an
1771            NFS share and you encounter this issue, one option would be to
1772            switch to the nfs-kernel-server, or create a symlink so that the
1773            settings are stored locally.
1774     \endlist
1775
1776     \section1 Known Issues of Version 1.1.0
1777
1778     \list
1779         \o Paths or file names containing spaces or special characters, e.g.,
1780            colons, dollar signs, hash marks etc. may cause difficulties. This
1781            is because some of the tools Qt Creator uses in the background have
1782            restrictions on the characters allowed in file and directory names.
1783            To be on the safe side, we recommend creating projects and project
1784            items with names consisting of plain characters, numbers,
1785            underscores, and hyphens.
1786
1787         \o \c{.pro} files are reformatted if files have been added or removed.
1788            Whitespace is not preserved.
1789
1790         \o There is no IDE support for adding files to include (\c .pri) files.
1791
1792         \o There is no IDE support for adding/removing sub-projects. Project
1793            hierarchies (SUBDIRS template) have to be created manually.
1794
1795         \o The file system sidebar does not update automatically. As a
1796            workaround, switch to another directory and then back.
1797
1798         \o Loading KDE4 designer plugins breaks the style in KDE < 4.2.1
1799            due to a bug in KDE.
1800
1801         \o The DEFINES and INCLUDES set in \c{.pro} files are not dealt with
1802            on a file-specific level. Because of this, handling of DEFINES has
1803            been disabled completely. Also the \c{.qmake.cache} is not being
1804            parsed. In general, the \c{.pro} file parser is incomplete and
1805            problems are still to be expected.
1806
1807         \o Code completion for generated UI header files is updated only
1808            after a build.
1809
1810         \o Code completion does not support typedefs for nested classes.
1811
1812         \o There is a kernel bug essentially making debugging unreliable on
1813            2.6.24 kernels for i386 (which is, unfortunately, the default on
1814            Ubuntu 8.04). See
1815            \l{https://bugs.launchpad.net/ubuntu/+source/gdb/+bug/230315/} for
1816            details. The only solution to this problem is to boot another
1817            kernel.
1818
1819         \o Gdb may take long to load debugging symbols, especially from large
1820            libraries like \c libQtWebKit. Starting the debugging module can
1821            take up to several minutes without visible progress.
1822
1823         \o Setting breakpoints in files that do not have unique absolute
1824            paths may fail. For example, remounting parts of a file system
1825            using the --bind mount option.
1826
1827         \o There is no syntax highlighting for \c CMake project files.
1828
1829         \o Project files included from \c{CMakeLists.txt} are not shown in the
1830            navigation tree.
1831
1832         \o Using the Visual Studio Compiler with \c CMake is unsupported.
1833
1834         \o Creating new \c CMake projects with Qt Creator is unsupported.
1835
1836         \o Having more than one build directory for \c CMake is not supported.
1837
1838         \o Changing the build directory for \c CMake after the initial import
1839            is disabled.
1840     \endlist
1841 */
1842
1843
1844 /*!
1845     \contentspage index.html
1846     \previouspage creator-known-issues.html
1847     \page creator-acknowledgements.html
1848
1849     \title Acknowledgements
1850
1851     \section1 Third-party Components
1852
1853     Qt Creator contains the following third-party components:
1854
1855     \list
1856     \o  \bold{Open Source front-end for C++ (license MIT)}, enhanced for use in
1857         Qt Creator.\br
1858         Roberto Raggi <roberto.raggi@gmail.com>\br
1859         QtCreator/src/shared/cplusplus
1860     \endlist
1861 */