Newer
Older

Rohan Shetty
committed
operating system.
\o In Qt Creator select \gui Tools > \gui Options... >
\gui Environment > \gui General.
\o In \gui{External editor} enter the name of the application followed
by \key Space and \tt{\bold %f}. For example, to open the file in
Smultron, enter \tt{\bold{smultron %f}}.
To further define how to open the file in the external editor, you
can use the following variables separated by a space:
\list
\o Current line number \tt{\bold %l}
\o Current column number \tt{\bold %c}
\o Editor's x position on the screen \tt{\bold %x}
\o Editor's y position on the screen \tt{\bold %y}
\o Editor's width in pixels \tt{\bold %w}
\o Editor's height in pixels \tt{\bold %h}
\o Editor's width in characters \tt{\bold %W}
\o Editor's height in characters \tt{\bold %H}
\o To pass % symbol to the editor \tt{\bold %%}
\endlist
\note Not all variables work with all editors.
\endlist

Kavindra Palaraja
committed
*/

Leena Miettinen
committed
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
/*!
\contentspage index.html
\previouspage creator-editor-codepasting.html
\page creator-editor-options.html
\nextpage creator-editor-fakevim.html
\title Configuring the Editor
Qt Creator allows you to configure the text editor to suit your specific
needs. To configure the editor, select \gui Tools > \gui{Options...} >
\gui{Text Editor}.
You can perform the following configuration actions:
\list
\o Set the font preferences and apply syntax highlighting in
\gui{Font & Colors}.
\o Set tabs, indentation, the handling of whitespace, and mouse operations in
\gui Behavior.
\o Set various display properties, for example,
\l{Highlighting and folding blocks}{highlighting and folding blocks},
text wrapping or \l{Moving to symbol definition or declaration}
{moving to symbol definition or declaration}
in \gui Display.
\o Configure \l{Completing Code}{code completion} in \gui Completion.
\endlist
\section2 Configuring Fonts
You can select the font family and size. You can specify a zoom setting in
percentage for viewing the text. You can also zoom in or out by pressing
\key {Ctrl++} or \key {Ctrl +-}, or by pressing \key Ctrl and rolling
the mouse button up or down. To disable the mouse wheel function, select
\gui {Tools > Options... > Text Editor > Behavior} and deselect the
\gui {Enable scroll wheel zooming} check box.
Antialiasing is used by default to make text look smoother and more
readable on the screen. Deselect the \gui Antialias check box to
turn off antialiasing.
\section2 Defining Color Schemes
You can select one of the predefined color schemes for syntax highlighting
or create customized color schemes. To create a color scheme:
\list 1
\o Select \gui {Tools > Options... > Text Editor > Fonts & Color > Copy}.
\o Enter a name for the color scheme and click \gui OK.
\o In the \gui Foreground field, specify the color of the selected
code element.
\o In the \gui Background field, select the background
color for the code element.
The backgound of the \gui Text element determines the background of the
code editor.
\endlist
When you copy code from Qt Creator, it is copied in both plain text and HTML
format. The latter makes sure that syntax highlighting is preserved when
pasting to a rich-text editor.
\section2 Indenting Code
When you type code, it is indented automatically according to the selected
options. Select a block to indent it when you press \key Tab.
Press \key {Shift+Tab} to decrease the indentation.
When you press \gui Backspace the indentation is decreased by one level,
instead of one space, by default.
By default, the tab-length in code editor is 8 spaces, but you can change
it. The code editor can also determine whether tabs or spaces are used
on the previous or next line and copy the style.
You can determine whether the block indent style includes braces,
or you can use the GNU indent style. The GNU style places braces on a separate
line, indented by 2 spaces, except when they open a function definition, where
they are not indented.
The following code snippet illustrates excluding braces from the indented block:
\code
void foobar(bool zoo)
{
if (zoo)
{
foo();
}
}
\endcode
The following code snippet illustrates including braces in the indented block:
\code
void foobar(bool zoo)
{
if (zoo)
{
foo();
}
}
\endcode
The following code snippet illustrates the GNU style:
\code
void foobar(bool zoo)
{
if (zoo)
{
foo();
}
}
\endcode
*/
\previouspage creator-editor-using.html
\page creator-editor-finding.html
\nextpage creator-editor-refactoring.html
To search through the currently open file:
\list 1
\o Press \key Ctrl+F or select \gui Edit > \gui Find/Replace >

Rohan Shetty
committed
\gui{Find/Replace}.
\o Enter the text you are looking for.
If the text is found, all occurrences are highlighted as you type.
\o To go to the next occurrence, click \inlineimage qtcreator-next.png
, or press \key F3. To go to the previous occurrence click
\inlineimage qtcreator-previous.png
, or press \key Shift+F3.
\endlist

Leena Miettinen
committed
You can restrict the search in the \gui Find field by selecting one
or several search criteria:
\list
\o To make your search case sensitive, select
\inlineimage qtcreator-editor-casesensitive.png
.
\o To search only whole words, select
\inlineimage qtcreator-editor-wholewords.png
.
\o To search using regular expressions, select
\inlineimage qtcreator-editor-regularexpressions.png
.

Leena Miettinen
committed
Regular expressions used in Qt Creator are modeled on Perl regular
expressions. For more information on using regular expressions, see

Leena Miettinen
committed
\l {http://doc.qt.nokia.com/4.6/qregexp.html#details}
{Detailed Description} in the QRegExp Class Reference.

Leena Miettinen
committed
\note If you have selected text before selecting \gui Find/Replace, the
search is conducted within the selection.
To replace occurrences of the existing text, enter the new text in the

Leena Miettinen
committed
\gui{Replace with} field.
\list
\o To replace the selected occurrence and move to the next one,
click \inlineimage qtcreator-next.png
or press \key Ctrl+=.
\o To replace the selected occurrence and move to the previous one,
click \inlineimage qtcreator-previous.png
.
\o To replace all occurrences in the file, click \gui{Replace All}.
\endlist
To search through projects, files on a file system or the currently open
file:
\list 1
\o Press \key Ctrl+Shift+F or select \gui Edit >
\gui Find/Replace > \gui{Advanced Find} >
\gui{Open Advanced Find...}.
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
\o Select the scope of your search:
\list
\o \gui{All Projects} searches files matching the defined file
pattern in all currently open projects.
For example, to search for \tt previewer only in \tt .cpp
and \tt .h files, enter in \gui{File pattern}
\tt *.cpp,*.h.
\image qtcreator-search-allprojects.png
\o \gui{Current Project} searches files matching the defined file
pattern only in the project you are currently editing.
\o \gui{Files on File System} recursively searches files matching
the defined file pattern in the selected directory.
\o \gui{Current File} searches only the current file.
\endlist
\o Enter the text you are looking for and click \gui Search.
\image qtcreator-searchresults.png
A list of files containing the searched text is displayed in the
\gui{Search Results} pane.
\list
\o To see all occurrences in a file, double-click the file name in
the list.
\o To go to an occurrence, double-click it.
\endlist
\endlist
*/
/*!
\contentspage index.html
\previouspage creator-editor-finding.html
\page creator-editor-refactoring.html
\nextpage creator-editor-locator.html
Code refactoring is the process of changing the code without modifying the
existing functionality of your application. By refactoring your code you
can:
\list
\o Improve internal quality of your application
\o Improve performance and extensibility
\o Improve code readability and maintainability
\o Simplify code structure
\endlist
To find the use of a specific symbol in your project:
\list 1
\o In the editor place the cursor on the symbol and select \gui Tools

Rohan Shetty
committed
> \gui C++ > \gui{Find Usages} or press
\key Ctrl+Shift+U.
Qt Creator looks for the symbol in the following locations:
\list
\o Files listed as a part of the project
\o Files directly used by the project files (for example, generated
files)
\o Header files of used frameworks and libraries
\endlist
\o The \gui{Search Results} pane opens and shows the location and
number of instances of the symbol in the current project.
\image qtcreator-refactoring-find.png
\endlist
You can browse the search results in the following ways:
\list
\o To go directly to an instance, double-click the instance in the
\gui{Search Results} pane.
\o To move between instances, click
\inlineimage qtcreator-forward.png
and
\inlineimage qtcreator-back.png
in the \gui{Search Results} pane.
\o To expand and collapse the list of all instances, click
\inlineimage qtcreator-expand.png
.
\o To clear the search results, click \inlineimage qtcreator-clear.png
.
\endlist

Leena Miettinen
committed
\if defined(qtquick)

Leena Miettinen
committed
The functions used to rename symbols depends on whether you are
writing C++ or QML code. For QML, you can only rename IDs.

Leena Miettinen
committed
\endif

Leena Miettinen
committed
To rename a specific symbol in a Qt project:
\o In the editor, place the cursor on the symbol you would like to
change and select \gui Tools > \gui C++ >

Rohan Shetty
committed
\gui{Rename Symbol Under Cursor} or press \key Ctrl+Shift+R.
The \gui{Search Results} pane opens and shows the location and
number of instances of the symbol in the current project.
\image qtcreator-refactoring-replace.png
\o To replace all selected instances, enter the name of the new symbol
in the \gui{Replace with} text box and click \gui Replace.
To omit an instance, uncheck the check-box next to the instance.
\note This action replaces all selected instances of the symbol in
all files listed in the \gui{Search Results} pane. You cannot
undo this action.

Kavindra Palaraja
committed

Leena Miettinen
committed
\note Renaming local symbols does not open the \gui{Search Results} pane.
The instances of the symbol are highlighted in code and you can edit the
symbol. All instances of the local symbol are changed as you type.

Leena Miettinen
committed

Leena Miettinen
committed
\if defined(qtquick)

Leena Miettinen
committed
To rename an ID in a Qt Quick project:
\list 1
\o Right-click an ID in the QML code and select
\gui {Rename id}.
\o In the \gui {Rename id} field, enter the new ID.
\endlist

Leena Miettinen
committed
\endif

Leena Miettinen
committed
*/

Kavindra Devi Palaraja
committed

Kavindra Palaraja
committed
/*!
\contentspage index.html

Leena Miettinen
committed
\previouspage creator-editor-external.html
\page creator-project-managing.html
\nextpage creator-project-creating.html
\title Managing Projects

Leena Miettinen
committed
One of the major advantages of Qt Creator is that it allows a team of
developers to share a project across different development platforms with a common
tool for development and debugging.
The recommended way to build a project is to use a \l{Using Version Control Systems} {version control system}.
Store and edit only project source files and the .pro and .pri files (for qmake)
or CMakeLists.txt and *.cmake files (for CMake). Do not store
files generated by the build system or Qt Creator, such as makefiles,
.pro.user, and object files. Other approaches are possible,
but we recommend that you do not use network resources, for example.
Qt Creator allows you to specify separate \l{Building for Multiple Targets} {build settings}

Leena Miettinen
committed
for each development platform. By default, \l{glossary-shadow-build}{shadow builds} are used to

Leena Miettinen
committed
keep the build specific files separate from the source.
You can create separate versions of project files to keep platform-dependent
code separate. You can use qmake
\l{http://qt.nokia.com/doc/4.2/qmake-tutorial.html#adding-platform-specific-source-files}{scopes}
to select the file to process depending on which platform qmake is run on.
Items such as open files, breakpoints, and watches are stored in
\l{Managing Sessions}{sessions}. They are not considered to be part of the
information shared across platforms.
Qt Creator is integrated with cross-platform systems for build automation:
qmake and CMake. In addition, you can import generic projects that do not use qmake
or CMake, and specify that Qt Creator ignores your build system.
\o To use \bold{qmake} to build applications, open a \c .pro file. For more
\o To use \bold{CMake} to build applications you need to have CMake version
2.8.0 or later installed. For more information, see
\l{Setting Up a CMake Project}.
\o To use \bold{other build systems} to build applications, specify which files belong to

Leena Miettinen
committed
your project and which include directories or defines you want to pass
to your compiler. For more information, see
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
Qt Creator provides support for \l{Building and Running Applications}{building and running} Qt applications for
desktop environment and mobile devices. When you install the Nokia Qt SDK,
the build and run settings for the desktop, Maemo, and Symbian targets are set up
automatically. However, you need to install and configure some additional software
on the devices:
\list
\o \l{Setting Up Development Environment for Maemo}.
\o \l{Setting Up Development Environment for Symbian}.
\endlist
\note The only supported build system for mobile applications in Qt
Creator is qmake.
Once your mobile application is ready, you can test it in the Qt Simulator.
You can also connect Maemo and Symbian devices to your development PC and
debug applications on the devices. After you have tested the application,
you can deploy it on mobile devices.
Developing applications for mobile devices is different from developing
desktop applications. For more information, see
\l{Optimizing Applications for Mobile Devices}.
To change the location of the project directory, and to make changes in
the build and run settings, select \gui{Tools} > \gui{Options...} >
\gui{Projects} > \gui{General}.
Through external libraries Qt Creator can support code completion and
syntax highlighting for external libraries as if they were a part of the
current project or the Qt library.
The procedure of adding a library to a project depends on the type of
project, which influences the build system used.
\list
\o For information on adding external libraries to qmake projects, see
\l{Adding External Libraries to a qmake Project}.
\o For information on adding external libraries to CMake projects, see
\l{Adding External Libraries to a CMake Project}.
\endlist
*/
/*!
\contentspage index.html
\previouspage creator-project-managing.html
\page creator-project-creating.html
\nextpage creator-project-qmake.html
You use wizards to create and import several types of projects and files, such

Leena Miettinen
committed
as Qt GUI or console applications.
\if defined(qtquick)
and Qt Quick applications
\endif

Leena Miettinen
committed
You can also use
wizards to add individual files to your projects. For example, you can create
the following types of files:
\list
\o Qt resource files, which allow you to store binary files in the
application executable

Leena Miettinen
committed
\if defined(qtquick)
\o \QD forms and Qt QML files, which specify parts of application user
interfaces

Leena Miettinen
committed
\endif
\o C++ class, source, or header files
\endlist
The wizards prompt you to enter the settings needed
for that particular type of project and create the necessary files for you.
\image qtcreator-new-project.png
\section1 Using Project Wizards

Leena Miettinen
committed
\o Select \gui File > \gui{New File or Project} and select the type of your

Leena Miettinen
committed
The contents of the following dialogs depend on the project type.
Follow the instructions of the wizard.

Leena Miettinen
committed
This example uses \gui {Qt Gui Application}.
\o Name the project and set its path. To select the path from a

Leena Miettinen
committed
directory tree, click \gui Browse.
Avoid using spaces and special characters in the project name and
path.
\image qtcreator-intro-and-location.png
\o Specify the name of the class you want to create and using the
drop-down menu select its base class type.
Note that the \gui{Header file}, \gui{Source file} and
\gui{Form file} fields are automatically updated as you name your
class.
\image qtcreator-class-info.png
\o Review the project settings.

Leena Miettinen
committed
To create the project, click \gui Finish.
\image qtcreator-new-project-summary.png
\endlist
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
\section1 Adding New Project Wizards
If you have a team working on a large application or several applications,
you might want to standardize the way the team members create projects
and classes.
You can use the wizard templates in the \c {share/qtcreator/templates/wizards}
folder to create your own project and class wizards. Qt Creator looks in the
folder and adds all wizards defined in wizard.xml files to the \gui New dialog
that opens when you select \gui {File > New File or Project}.
In a project wizard, you can specify the files needed in a project.
You can add wizard pages to allow developers to specify settings for the
projcet.
In a class wizard, you can allow developers to specify the class name, base
class, and header and source files for the class.
To see how this works, rename wizard_example.xml as wizard.xml in the helloworld
and listmodels folders. After you restart Qt Creator, the \gui {Custom Classes}
and \gui {Custom Projects} categories appear in the \gui New dialog.
\image qtcreator-custom-project-wizards.png "The New dialog with custom projects and classes"
\section2 Creating Project Wizards
To create a project wizard:
\list 1
\o Make a copy of the \c {share/qtcreator/templates/wizards/helloworld} or
\c {share/qtcreator/templates/wizards/listmodel} folder.
\o Modify the wizard_example.xml file.
\o The following code determines the type of the wizard and its place
in the \gui New dialog:
\code
<wizard version="1" kind="project"
class="qt4project" firstpage="10"
id="A.HelloWorld" category="B.CustomProjects">
\endcode
\list
\o \c version is the version of the file contents. Do not modify this value.
\o \c kind specifies the type of the wizard: \c project or \c class.
\o \c class specifies the type of the project. Currently the only available
type is \c qt4project, which specifies a Qt console project.
\o \c firstpage specifies the place of the new page in the standard project
wizard. The value 10 ensures that the custom page appears after the standard
pages, as the last page of the wizard.
\o \c id is the unique identifier for your wizard. The letter specifies the
position of the wizard within the \c category. The HelloWorld wizard appears
as the first wizard in the second category in the \gui New dialog.
\o \c category is the category in which to place the wizard in the list.
The letter specifies the position of the category in the list in the \gui New
dialog.
\endlist
\o The following code specifies the icon and text that appear in the \gui New
dialog:
\code
<icon>console.png</icon>
<description>Creates a hello-world-project with custom message.</description>
<description xml:lang="de">Erzeugt ein Hello-Welt-Projekt mit einer Nachricht.</description>
<displayname>Hello World</displayname>;
<displayname xml:lang="de">Hallo Welt</displayname>;
<displaycategory>Custom Projects</displaycategory>
<displaycategory xml:lang="de">Benutzerdefinierte Projekte</displaycategory>
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
\endcode
\list
\o \c icon appears next to the \c displayName.
\o \c description appears at the bottom of the \gui New dialog when you
select the display name.
\o \c displayName appears in the \gui New dialog, under the
\c displayCategory.
You can add translations as values for the text elements. Specify the target
language as an attribute for the element. Use locale names (QLocale).
For example, \c {xml:lang="de"}.
\endlist
\o The following code specifies the files to add to the project:
\code
<files>
<file source="main.cpp" openeditor="true" />
<file source="project.pro" target="%ProjectName%.pro" openproject="true" />
\endcode
\list
\o \c source specifies the file to copy to the project. The files must be
located in the wizard folder.
\o \c target specifies the new filename for the file. The \c {%ProjectName%}
variable is replaced with the string that users specify in the \gui Name
field on the first page of the wizard.
\o \c openproject indicates that the file is a project file which is to be opened
after the wizard has finished.
\o \c openeditor indicates that the file is to be opened in an editor after
the wizard has finished.
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
\endlist
\o The following code creates a page that specifies settings for the project:
\code
<!-- Create a 2nd wizard page with parameters -->
<fieldpagetitle>Hello World Parameters</fieldpagetitle>
<fieldpagetitle xml:lang="de">Hallo Welt Parameter</fieldpagetitle>
<fields>
<field mandatory="true" name="MESSAGE">
<fieldcontrol class="QLineEdit" validator='^[^"]+$' defaulttext="Hello world!" />
<fielddescription>Hello world message:</fielddescription>
<fielddescription xml:lang="de">Hallo-Welt-Nachricht:</fielddescription>
</field>
</fields>
\endcode
\list
\o \c fieldpagetitle specifies the title of the page.
\o \c field specifies whether the field is mandatory (\c true or \c false).
You can use the value of the \c name field as a variable in other files (for
example, \c {%MESSAGE%}.
\o \c fieldcontrol specifies the field. \c class specifies the field type.
You can use interface objects from the QWidget class to create fields. This
example uses QLineEdit to create an input field.
\o \c validator specifies a regular expression to check the characters allowed in
the field.
\o \c defaulttext specifies text that appears in the field by default.
\o \c fielddescription specifies the field name that appears on the wizard page.
\endlist
\endlist
\section2 Creating Class Wizards
The widget.xml file for a class wizard is very similar to that for a project
wizard. The differences are discussed below.
To create a class wizard:
\list 1
\o The following code specifies settings for the wizard:
\code
<wizard version="1" kind="class" id="A.ListModel" category="B.CustomClasses">
<description>Creates a QAbstractListModel implementation.</description>
<description xml:lang="de">Erzeugt eine Implementierung von QAbstractListModel.</description>
<displayname>QAbstractListModel implementation</displayname>
<displayname xml:lang="de">Implementierung von QAbstractListModel</displayname>
<displaycategory>Custom Classes</displaycategory>
<displaycategory xml:lang="de">Benutzerdefinierte Klassen</displaycategory>
\endcode
For more information about the elements and their values, see
\l {Creating Project Wizards}.
\o The following code specifies the files to add to the project:
\code
<files>
<file source="listmodel.cpp" target="%ClassName:l%.%CppSourceSuffix%" openeditor="true" />
<file source="listmodel.h" target="%ClassName:l%.%CppHeaderSuffix%" openeditor="true" />
</files>
\endcode
Here, \c target contains the following variables that are used to construct
the filename:
\list
\o \c {%ClassName:l%} is replaced with the value of the \c ClassName field.
The modifier \c l converts the string to lower case, to observe Qt
conventions.
\o \c {%CppSourceSuffix%} is replaced by the default source suffix, which
is defined in Qt Creator in \gui {Tools > Options... > C++ > File Naming}.
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
For example, if users enter \bold MyClass, the filename becomes myclass.cpp
when the project is created.
\o \c {%CppHeaderSuffix%} is replaced by the default header suffix, which
is also defined in \gui {File Naming}. Here, the filename would
become myclass.h.
\endlist
\o The following code creates a page that allows users to select the class
name, base class, and header and source files for the class:
\code
<!-- Create parameter wizard page -->
<fieldpagetitle>ListModel parameters</fieldpagetitle>
<fieldpagetitle xml:lang="de">Parameter des ListModel</fieldpagetitle>
<fields>
<field name="ClassName">
<fieldcontrol class="QLineEdit" validator="^[a-zA-Z0-9_]+$" defaulttext="MyListModel" />
<fielddescription>Class name:</fielddescription>
<fielddescription xml:lang="de">Klassenname:</fielddescription>
</field>
<field name="Datatype">
<fieldcontrol class="QComboBox" combochoices="QString,int" defaultindex="0" />
<fielddescription>Data type:</fielddescription>
<fielddescription xml:lang="de">Datentyp:</fielddescription>
</field>
</fields>
\endcode
In addition to QLineEdit, QComboBox is used in the class wizard to create
a field. \c combochoices specifies the options in the combobox and
\c defaultindex specifies that QString is the default value.
\endlist
\previouspage creator-project-creating.html
\page creator-project-qmake.html
\nextpage creator-project-cmake.html

Leena Miettinen
committed
The qmake tool helps simplify the build process for development projects
across different platforms. qmake automates the generation of makefiles
so that only a few lines of information are needed to create each makefile.
qmake can be used for any software project, whether it is written in Qt or not.
The qmake tool generates a makefile based on the information in a project
file that is generated by Qt Creator. It can generate makefiles for MinGW,
Microsoft Visual studio, and CSL ARM in Windows, and GNU Compiler Collection
(GCC) in Linux and Mac OS X.
For more information about qmake, see the
\l{http://qt.nokia.com/doc/4.2/qmake-manual.html}{qmake Manual}.
\section1 Selecting the Qt Version
Qt Creator allows you to have multiple versions of Qt installed on
your development PC and use different versions for each of your projects.
If Qt Creator finds \bold qmake in the \c{PATH} environment variable, it uses
that version. The \l{glossary-system-qt}{ qmake version of Qt} is referred
to as \bold{Qt in PATH}. If you intend to use only one version of Qt and it
is already in the \c{PATH} and correctly set up for command line use, you do
not need to manually configure your Qt version.
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
\section2 Windows
To add a Qt version for \bold MinGW:
\list 1
\o Select \gui Tools > \gui Options... > \gui Qt4 >
\gui{Qt Versions}.
\o Click \inlineimage qtcreator-windows-add.png
and enter the name of the version in \gui{Version Name} field.
\o Enter the qmake binary path in the \gui{qmake Location}.
\o Enter the MinGW installation path in the \gui{MinGW Directory}.
\image qtcreator-qt4-qtversions-win-mingw.png
\endlist
To add a Qt version for a \bold{Microsoft Visual C++} compiler:
\list 1
\o Select \gui Tools > \gui Options... > \gui Qt4 >
\gui{Qt Versions}.
\o Qt Creator automatically sets the correct environment variables for
compilation. Select the internal version number of the installed
Microsoft Visual C++ tool chain in the \gui Toolchain list.
\image qtcreator-qt4-qtversions-win-msvc.png
\endlist
If you are using \bold{Qt for Symbian} and your S60 SDK is registered
with devices.exe, Qt Creator automatically detects the Qt version. To add a
Qt for Symbian version:
\list 1
\o Select \gui Tools > \gui Options... > \gui Qt4 >
\gui{Qt Versions}.
\o Select the \gui{S60 SDK} you want the Qt Creator to use.
\image qtcreator-qt4-qtversions-win-symbian.png
\o To build an application for your device using GCCE, enter the path
to the \bold{CSL ARM Toolchain} directory in
\gui{CSL\\GCCE Directory}.
You do not need to specify this path if the compiler is included in
the \c{PATH} environment variable.
\o To build an application for the emulator (WINSCW toolchain), enter
the path to your Carbide C++ installation directory in
\gui{Carbide Directory}.
\note You need to have Carbide C++ version 2.0 or later installed.
\section2 Compiling Projects With Linux
To compile a project in Qt Creator, Linux uses GNU Compiler Collection
(GCC). Intel Compiler Collection (ICC) is supported as a drop-in
replacement for GCC.

Kavindra Devi Palaraja
committed
To add a Qt version:
\list 1
\o Select \gui Tools > \gui Options... > \gui Qt4 >
\gui{Qt Versions}.
\o Click \inlineimage qtcreator-linux-add.png
and enter the name of the version in \gui{Version Name}.
\o Enter the path to the qmake binary in \gui{Path to qmake}.
\endlist
\section2 Compiling Projects With Mac OS X
To compile a project in Qt Creator, Mac OS X uses GNU Compiler Collection
(GCC), which is part of Xcode.
To add a Qt version:
\list 1
\o Select \gui{Qt Creator} > \gui Preferences... > \gui{Qt Versions}.
\o Click \inlineimage qtcreator-macosx-add.png
and enter the name of the version in \gui{Version Name}.
\o Enter the path to the qmake binary in \gui{Path to qmake}.
\image qtcreator-qt4-qtversions.png
\endlist

Leena Miettinen
committed
\section1 Adding External Libraries to a qmake Project
Through external libraries Qt Creator can support code completion and
syntax highlighting as if they were part of the current project or the Qt
library.
To add an external library:
\list 1
\o Open your project file (.pro) using the \gui Projects pane.
\o Follow the instructions at \l{http://doc.qt.nokia.com/4.7-snapshot/qmake-project-files.html#declaring-other-libraries}

Leena Miettinen
committed
{Declaring other Libraries}.
\endlist
Syntax completion and highlighting work once your project successfully
builds and links against the external library.

Leena Miettinen
committed
\previouspage creator-project-managing-sessions.html

Leena Miettinen
committed
\nextpage creator-building-targets.html
\title Building and Running Applications
Qt Creator provides support for building and running Qt applications for
desktop environment and mobile devices. When you install the Nokia Qt SDK,
the build and run settings for the desktop, Maemo, and Symbian targets are
set up automatically.
You can select the targets and click the \gui Run button to build and
run the applications on the targets. You can click the \gui {Build All}
button to build all open projects, one after another.
To view and modify the settings for currently open projects, switch to the
The project pane consists of the following tabs:

Leena Miettinen
committed
\o \l{Building for Multiple Targets}{Targets}
\o \l{Specifying Editor Settings}{Editor Settings}
\o \l{Specifying Dependencies}{Dependencies}
Use the \gui Build and \gui Run buttons to switch between
the build and run settings for the active project.
If you have multiple projects open in Qt Creator, use
\gui{Select a Project} option at the top to navigate between different
project edits.

Leena Miettinen
committed
*/
/*!
\contentspage index.html
\previouspage creator-building-running.html
\page creator-building-targets.html
\nextpage creator-build-settings.html
\title Building for Multiple Targets
Different build configurations allow you to quickly switch between
different build settings. By default, Qt Creator creates \bold debug

Leena Miettinen
committed
\section1 Building for Desktop
\list 1
\o Select \gui Desktop as the target.
\o Click the \gui Run button.
\endlist

Leena Miettinen
committed
\section1 Building for Qt Simulator
You can use the Qt Simulator to test Qt applications that are intended
for mobile devices in an environment similar to that of the device. You
can change the information that the device has about its configuration
and environment.
\list 1
\o Select \gui {Qt Simulator} as the target.
\o Click the \gui Run button.
\endlist
For more information about using the Qt Simulator, see the
\l{http://doc.qt.nokia.com/qt-simulator-beta/index.html}{Qt Simulator Manual}.
\section1 Building for Maemo
\o Build and run the application for \l{Building for Qt Simulator}{Qt Simulator}.