Skip to content
Snippets Groups Projects
qtcreator.qdoc 253 KiB
Newer Older
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

    In Qt Creator you can move directly to the definition or the declaration of
    a symbol by holding the \key Ctrl and clicking the symbol.

    To enable this moving function, in \gui Tools > \gui{Options...} >
    \gui{Text Editor} > \gui Behavior select \gui{Enable mouse navigation}.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

    \section1 Using Update Code Model

    To refresh the internal information in Qt Creator pertaining to your code,
    select \gui{Tools} > \gui{C++} > \gui{Update Code Model}.
    \note In Qt Creator indexing updates the code automatically. Use
    \gui{Update Code Model} only as an emergency command.
/*!
    \contentspage index.html
    \previouspage creator-editor-locator.html
    \page creator-editor-codepasting.html
    \nextpage creator-editor-options.html

    \title Pasting and Fetching Code Snippets
    In Qt Creator, you can paste snippets of code to a server or fetch
    snippets of code from the server. To paste and fetch snippets of code,
    Qt Creator uses the following:
    \list
        \o \gui{CodePaster}
        \o \gui{Pastebin.Com}
        \o \gui{Pastebin.Ca}
    \endlist

    To configure the server, select \gui{Tools} > \gui{Options...} >
    \gui{Code Pasting}.

    To paste a snippet of code onto the server, select \gui{Tools} >
    \gui{Code Pasting} > \gui{Paste Snippet...} or press \key{Alt+C,Alt+P}.

    To fetch a snippet of code from the server, select \gui{Tools} >
    \gui{Code Pasting} > \gui{Fetch Snippet...} or press \key{Alt+C,Alt+F}.

    \note To use \gui{Pastebin.Com}, configure the domain
    prefix in \gui{Tools} > \gui{Options...} > \gui{Code Pasting} >
    \gui{Pastebin.com}.

    For example, you might ask colleagues to review a change that you plan to
    submit to a version control system. If you use the Git version control system,
    you can create a \e{diff} view by selecting \gui{Tools} > \gui{Git} >
    \gui{Diff Repository}. You can then upload its contents to the server by choosing
    \gui{Tools} > \gui{Code Pasting} > \gui{Paste Snippet...}. The reviewers can retrieve
    the code snippet by selecting \gui{Tools} > \gui{Code Pasting} > \gui{Fetch Snippet...}.
    If they have the project currently opened in Qt Creator, they can apply and test
    the change by choosing \gui{Tools} > \gui{Git} > \gui{Apply Patch}.
*/


/*!
    \contentspage index.html
    \previouspage creator-editor-options.html
    \page creator-editor-fakevim.html
    \nextpage creator-editor-external.html

    \title Using FakeVim Mode

    In the \gui{FakeVim} mode, you can run the main editor in a manner similar
    to the Vim editor. To run the editor in the \gui{FakeVim} mode, select
    \gui{Edit} > \gui{Advanced} > \gui{Use Vim-style Editing} or press
    \key{Alt+V,Alt+V}.

    In the \gui{FakeVim} mode, most keystrokes in the main editor will be
    intercepted and interpreted in a way that resembles Vim. Documentation for
    Vim is not included in Qt Creator. For more information on using Vim,
    see \l{http://www.vim.org/docs.php}{Documentation} on the Vim web site.

    To map commands entered on the \gui{FakeVim} command line to actions of the
    Qt Creator core, select \gui{Tools} > \gui{Options...} > \gui{FakeVim} >
    \gui{Ex Command Mapping}.

    To make changes to the Vim-style settings, select \gui{Tools} >
    \gui{Options...} > \gui FakeVim > \gui{General}.

    To use a Vim-style color scheme, select \gui {Tools > Options... >
    Text Editor > Fonts & Color}. In the \gui {Color Scheme} list, select
    \gui {Vim (dark)}.
    To quit the FakeVim mode, click \gui {Quit FakeVim} or press
    \key{Alt+V,Alt+V}.

    */


/*!
    \contentspage index.html
    \previouspage creator-editor-fakevim.html
    \page creator-editor-external.html
    \nextpage creator-design-mode.html
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

    To open the file you are currently viewing in an external editor, select
    \gui Edit > \gui Advanced > \gui{Open in External Editor}.

    To use the external editor of your choice:
    \list 1
        \o Add the editor path to the \c{PATH} environment variable of your
           operating system.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
        \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}}.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

           To further define how to open the file in the external editor, you
           can use the following variables separated by a space:
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
           \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
/*!
    \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

*/


con's avatar
con committed
/*!
    \contentspage index.html
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \previouspage creator-editor-using.html
    \page creator-editor-finding.html
    \nextpage creator-editor-refactoring.html
con's avatar
con committed

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \title Finding and Replacing
con's avatar
con committed

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    To search through the currently open file:
    \list 1
        \o Press \key Ctrl+F or select \gui Edit > \gui Find/Replace >
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
        \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
con's avatar
con committed

    You can restrict the search in the \gui Find field by selecting one
    or several search criteria:
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \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
           .
           Regular expressions used in Qt Creator are modeled on Perl regular
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
           expressions. For more information on using regular expressions, see
           \l {http://doc.qt.nokia.com/4.6/qregexp.html#details}
           {Detailed Description} in the QRegExp Class Reference.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \endlist
con's avatar
con committed

    \note If you have selected text before selecting \gui Find/Replace, the
    search is conducted within the selection.

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    To replace occurrences of the existing text, enter the new text in the
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \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
con's avatar
con committed

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \section1 Advanced Search
con's avatar
con committed

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    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...}.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
        \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
*/
con's avatar
con committed


Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
/*!
    \contentspage index.html
    \previouspage creator-editor-finding.html
    \page creator-editor-refactoring.html
    \nextpage creator-editor-locator.html
con's avatar
con committed

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \title Refactoring
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    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
con's avatar
con committed

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \section1 Finding Symbols
con's avatar
con committed

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    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
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
           \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
con's avatar
con committed

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    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
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \section1 Renaming Symbols

    The functions available for renaming symbols depend on whether you are
    writing C++ or QML code. For QML, you can only rename IDs.

    To rename a specific symbol in a Qt project:
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \list 1
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
        \o In the editor, place the cursor on the symbol you would like to
           change and select \gui Tools > \gui C++ >
           \gui{Rename Symbol Under Cursor} or press \key Ctrl+Shift+R.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

           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.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \endlist
    \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.

    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
    \previouspage creator-qml-application.html
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \page creator-project-managing.html
    \nextpage creator-project-creating.html

    \title Managing Projects
con's avatar
con 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.

Leena Miettinen's avatar
Leena Miettinen committed
    Qt Creator allows you to specify separate \l{Building for Multiple Targets} {build settings}
    for each development platform. By default, \l{glossary-shadow-build}{shadow builds} are used to
    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.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \list
Leena Miettinen's avatar
Leena Miettinen committed
       \o To use \bold{qmake} to build applications, open a \c .pro file. For more
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
          information, see \l{Setting Up a qmake Project}.
Leena Miettinen's avatar
Leena Miettinen committed
       \o To use \bold{CMake} to build applications you need to have CMake version
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
          2.8.0 or later installed. For more information, see
          \l{Setting Up a CMake Project}.
Leena Miettinen's avatar
Leena Miettinen committed
       \o To use \bold{other build systems} to build applications, specify which files belong to
          your project and which include directories or defines you want to pass
          to your compiler. For more information, see
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
          \l{Setting Up a Generic Project}.
    \endlist
con's avatar
con committed

Leena Miettinen's avatar
Leena Miettinen committed
    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 Maemo and Symbian targets are set up
Leena Miettinen's avatar
Leena Miettinen committed
    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}.

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \section1 External Libraries
con's avatar
con committed

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    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.
con's avatar
con committed

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    The procedure of adding a library to a project depends on the type of
    project, which influences the build system used.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \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

*/
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
/*!
    \contentspage index.html
    \previouspage creator-project-managing.html
    \page creator-project-creating.html
    \nextpage creator-project-qmake.html
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \title Creating a Project
    You use wizards to create and import several types of projects and files, such
    as Qt GUI or console applications and Qt Quick applications.
    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

        \o \QD forms and Qt QML files, which specify parts of application user
        interfaces

        \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.
    To display other types of files in the \gui Projects pane, specify them in
    the project file.

    \image qtcreator-new-project.png

    \section1 Using Project Wizards

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    To create a new project:
    \list 1
        \o Select \gui File > \gui{New File or Project} and select the type of your
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
           project.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

           The contents of the following dialogs depend on the project type.
           Follow the instructions of the wizard.
           This example uses \gui {Qt Gui Application}.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
        \o Name the project and set its path. To select the path from a
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
           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.

           To create the project, click \gui Finish.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

           \image qtcreator-new-project-summary.png
    \endlist
    \section1 Displaying Additional File Types in Projects Pane

    Qt Creator determines whether to display files from the project folder
    in the \gui Projects pane depending on the file type (.pro, .pri, .cpp,
    .h, .ui, .qrc, and so on). To display other types of files, edit the the
    project file. Add filenames as values of the \c {OTHER_FILES} variable.
    You can also use wildcards.

    For example, the following code specifies that text files are displayed
    in the \gui Projects pane:

    \code

    OTHER_FILES += *.txt

    \endcode

    This also makes the files available in the \gui Locator.

    \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>

        \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.

        \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}.
        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

con's avatar
con committed
*/

con's avatar
con committed
/*!
    \contentspage index.html
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \previouspage creator-project-creating.html
    \page creator-project-qmake.html
    \nextpage creator-project-cmake.html
con's avatar
con committed

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \title Setting Up a qmake Project
con's avatar
con 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}.

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \section1 Selecting the Qt Version

    Qt Creator allows you to have multiple versions of Qt installed on
Leena Miettinen's avatar
Leena Miettinen committed
    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.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed


    \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.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

           \image qtcreator-qt4-qtversions-win-msvc.png
    \endlist

    If you are using \bold{Qt for Symbian} and your Symbian SDK is registered
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    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.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
        \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.
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    \endlist

    \section2 Compiling Projects With Linux
con's avatar
con committed

Oswald Buddenhagen's avatar
Oswald Buddenhagen committed
    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.
Oswald Buddenhagen's avatar
Oswald Buddenhagen 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
Oswald Buddenhagen's avatar
Oswald Buddenhagen committed

    To compile a project in Qt Creator, Mac OS X uses GNU Compiler Collection
    (GCC), which is part of Xcode.