Merge remote-tracking branch 'origin/3.3'

Conflicts:
	src/plugins/cppeditor/cppdocumentationcommenthelper.cpp

Change-Id: I2cf25eba1de149765a6c44ad354d606ce9de512d
This commit is contained in:
Eike Ziller
2015-01-08 10:38:20 +01:00
72 changed files with 4939 additions and 3784 deletions

2
README
View File

@@ -83,7 +83,7 @@ http://qt-project.org/wiki/Building_Qt_5_from_Git .
When using Visual C++ 2010, you must apply a hotfix that is available
from http://support.microsoft.com/kb/2280741
(See https://bugreports.qt-project.org/browse/QTBUG-11445).
(See https://bugreports.qt.io/browse/QTBUG-11445).
For the Visual C++ compilers, it is recommended to use the tool 'jom'.
It is a replacement for nmake that utilizes all CPU cores and thus

View File

@@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.

2
dist/known-issues vendored
View File

@@ -4,7 +4,7 @@ http://qt-project.org/doc/qtcreator/creator-known-issues.html
For a complete list of reported issues, see the Qt Bug Tracker:
https://bugreports.qt-project.org/
https://bugreports.qt.io/
For a list of fixed issues and added features, see the changelog file in the qtcreator\dist folder or the Qt Bug Tracker.

View File

@@ -676,7 +676,7 @@
For example, the Find plugin provides the FindFilter interface for
other plugins to implement. With the FindFilter interface, additional search
scopes can be added, that appear in the \gui {Advanced Search} dialog. The
scopes can be added, that appear in the \uicontrol {Advanced Search} dialog. The
Find plugin retrieves all FindFilter implementations from the global
object pool and presents them in the dialog. The plugin forwards the
actual search request to the correct FindFilter implementation, which

View File

@@ -23,7 +23,7 @@
\title External Tool Specification Files
An external tool specification file describes a tool that can be run from
the \gui { Tools > External } menu.
the \uicontrol { Tools > External } menu.
It specifies the name of the tool, the executable to run, optional
arguments, and how to handle the output from the tool.

View File

@@ -42,11 +42,11 @@
version that it was created with.
\list 1
\li Select \gui{File > New File or Project > Libraries > Qt Creator Plugin > Choose}.
\li Select \uicontrol{File > New File or Project > Library > Qt Creator Plugin > Choose}.
\image firstplugin-wizard.png "Choose the \QC Plugin Wizard"
The \gui{Introduction and Project Location} dialog opens.
The \uicontrol{Introduction and Project Location} dialog opens.
\image firstplugin-nameandpath.png "Choose Name and Place of the Project"
@@ -55,62 +55,62 @@
from the project name. You will choose that name later in the wizard.
Continue to the next page.
The \gui{Kit Selection} dialog opens.
The \uicontrol{Kit Selection} dialog opens.
\image firstplugin-kitselection.png "Choose the kit to build and run your project with"
\li Select the \l{glossary-buildandrun-kit}{kit} to build and run your project with.
For a \QC plugin this needs to be a kit with \gui{Desktop} device type,
For a \QC plugin this needs to be a kit with \uicontrol{Desktop} device type,
and a Qt version that is compatible with the Qt version that your
\QC was built with (in the best case the exact same build).
If you use an incompatible Qt version to build your plugin, you
will get errors while \QC tries to load your plugin.
Continue to the next page.
The \gui{Plugin Information} dialog opens.
The \uicontrol{Plugin Information} dialog opens.
\image firstplugin-pluginsetup.png "Specify Your Plugin Details"
\li In the \gui{Plugin name} field, type \gui{Example}. The name of the plugin
\li In the \uicontrol{Plugin name} field, type \uicontrol{Example}. The name of the plugin
is used as its identifier, and also is the base for the file names and
classes in the code.
\li The values of the following fields are mainly informational, and
are shown in the detailed view in \QC's plugin overview
(\gui{Help > About Plugins}, or \gui{Qt Creator > About Plugins}
(\uicontrol{Help > About Plugins}, or \uicontrol{Qt Creator > About Plugins}
on Mac).
\list
\li \gui{Vendor name} is a short one-word name of the company
\li \uicontrol{Vendor name} is a short one-word name of the company
or organization that created the plugin. This is also used for
the path name where the plugin will be deployed to.
\li \gui{Copyright} is a one-line, short copyright string.
\li \gui{License} is a multi-line license text (but shouldn't be pages over pages long,
\li \uicontrol{Copyright} is a one-line, short copyright string.
\li \uicontrol{License} is a multi-line license text (but shouldn't be pages over pages long,
since the interface doesn't allow nice reading of long texts).
\li \gui{Description} is a relatively short, but
\li \uicontrol{Description} is a relatively short, but
possibly multi-line description of what the plugin does.
\li \gui{URL} is a website where the user can find more
\li \uicontrol{URL} is a website where the user can find more
information about the plugin and/or organization providing it.
\endlist
\li Set the \gui{Qt Creator sources} and \gui{Qt Creator build} fields to
\li Set the \uicontrol{Qt Creator sources} and \uicontrol{Qt Creator build} fields to
the source and build directory of the \QC
instance you want to use to test your plugin with, respectively.
If you don't do that correctly you will get compile errors for your
plugin, and your plugin might not show up in \QC at all.
\li In the \gui{Deploy into} list, select \gui{Qt Creator build}. This sets
\li In the \uicontrol{Deploy into} list, select \uicontrol{Qt Creator build}. This sets
your .pro file up to deploy your plugin directly into your \QC build's
plugin directory (requires you to have write permissions there).
The other option, \gui{Local user settings}, sets your .pro file up to
The other option, \uicontrol{Local user settings}, sets your .pro file up to
deploy your plugin into \QC's user plugin path
(for example \c{~/.config/QtProject/qtcreator/plugins} on Unix systems).
We choose \gui{Qt Creator build} because we use a self-compiled
We choose \uicontrol{Qt Creator build} because we use a self-compiled
\QC, and want the plugin to be only loaded by that \QC
instance.
Continue to the next page.
The \gui{Project Management} dialog opens.
The \uicontrol{Project Management} dialog opens.
\image firstplugin-summary.png "Summary of Created Files"
@@ -129,10 +129,10 @@
\image firstplugin-runsettings.png "Specify the Executable to Run"
Select the path to the \QC executable from the build that you specified
in the \gui{Qt Creator build} setting in the project wizard and click \gui OK.
in the \uicontrol{Qt Creator build} setting in the project wizard and click \uicontrol OK.
\QC starts up, and you can verify that your plugin successfully loaded
by looking for a menu entry \gui{Tools > Example} and by looking for
the plugin in the \gui{About Plugins} dialog.
by looking for a menu entry \uicontrol{Tools > Example} and by looking for
the plugin in the \uicontrol{About Plugins} dialog.
\image firstplugin-menuitem.png "Menu Registered by the Plugin"
@@ -323,12 +323,12 @@
\snippet exampleplugin/exampleplugin.cpp add menu
Here a new menu item is created, the created command added to it, and the menu
added to the \gui{Tools} menu in the menu bar. Again, this is covered in more
added to the \uicontrol{Tools} menu in the menu bar. Again, this is covered in more
detail in \l{Menus and Menu Items}.
\snippet exampleplugin/exampleplugin.cpp slot implementation
This part defines the code that is called when the menu item is triggered.
It uses the Qt API to open a message box that displays informative text and
an \gui OK button.
an \uicontrol OK button.
*/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -78,7 +78,7 @@
\li Required
\li Boolean
\li Optional. Defaults to \c false.
Is used as a hint for the \gui{About Plugins...} dialog, that the user may not
Is used as a hint for the \uicontrol{About Plugins...} dialog, that the user may not
manually disable this plugin. Only used for the Core plugin.
\row
\li Platform
@@ -100,7 +100,7 @@
\li Category
\li String
\li Defaults to \c Utilities. Is used to put related plugins
under the same tree node in the plugin overview \gui{About Plugins...}.
under the same tree node in the plugin overview \uicontrol{About Plugins...}.
\row
\li Vendor
\li String

View File

@@ -202,12 +202,12 @@
\li \l{Core::INavigationWidgetFactory}
\row
\li Add an options page to the \gui Options dialog.
\li Add an options page to the \uicontrol Options dialog.
\li Add a new page to existing or new category in Tools > Options.
\li \l{Core::IOptionsPage}
\row
\li Add a find filter to the \gui Find dialog.
\li Add a find filter to the \uicontrol Find dialog.
\li Implement any kind of search term based search.
\li \l{Find::IFindFilter}, \l{Core::SearchResultWindow}

View File

@@ -42,7 +42,7 @@
\endlist
\li Providing a set of parameters that determine how the wizard shows up
in the list of wizards in the \gui{New File or Project} dialog.
in the list of wizards in the \uicontrol{New File or Project} dialog.
When deriving from Core::IWizard, virtual functions returning the
values have to be implemented.
@@ -117,7 +117,7 @@
\section2 Parameters
The parameters listed below determine how the wizard shows up
in the list of wizards in the \gui{New File or Project} dialog.
in the list of wizards in the \uicontrol{New File or Project} dialog.
Wizards in Qt Creator are grouped by categories.
@@ -190,7 +190,7 @@
On top of that, we implement validation logic to ensure content is entered.
We implement QWizardPage::isComplete() to return true when both input widgets
have contents, enabling the \gui{Next} button. For this to happen
have contents, enabling the \uicontrol{Next} button. For this to happen
as the user enters text, we need to connect to the changed() signal of the
controls and emit QWizardPage::completeChanged() once the complete status changes.
@@ -227,7 +227,7 @@
\section2 Plugin Registration
In order for the wizard to be found by the \gui{New} dialog, we need to
In order for the wizard to be found by the \uicontrol{New} dialog, we need to
register it with ExtensionSystem::PluginManager, which also takes care
of deleting it:

View File

@@ -60,7 +60,7 @@
\section2 File, Class and Project Templates
You can extend the wizards in \gui {File > New File or Project} with your
You can extend the wizards in \uicontrol {File > New File or Project} with your
own
file and project templates by writing XML definition files for them.
\list
@@ -187,7 +187,7 @@
tool. If starting the tool and handling its output require more complex
logic, you can add a menu item to Qt Creator with a plugin.
If you need a way to configure the tool in Qt Creator, you can add an
\gui Options page for it.
\uicontrol Options page for it.
\list
\li \l{http://doc.qt.digia.com/qtcreator/creator-editor-external.html}
{Using External Tools}
@@ -211,7 +211,7 @@
file, which is then opened within Qt Creator. You provide
an editor (probably read-only) for handling this file.
For lists of issues, consider creating task list files which are shown in
the \gui {Issues} output
the \uicontrol {Issues} output
pane.
\list
\li \l{http://doc.qt.digia.com/qtcreator/creator-task-lists.html}

View File

@@ -242,7 +242,7 @@
Compare the initial and optimized images to check that image quality is
preserved. If the image quality deteriorates, do not use color reduction
(select the \gui {True Color} option, instead).
(select the \uicontrol {True Color} option, instead).
You can also see the sizes of the initial and optimized image.
@@ -294,7 +294,7 @@
\c {share/doc/qtcreator} directory in the \QC build directory on Windows and
Linux, and in the \c {bin/Qt Creator.app/Contents/Resources/app} directory
on OS X. You can view the HTML files in a browser and the help files in
the \QC \gui Help mode. For more information about adding the help files to
the \QC \uicontrol Help mode. For more information about adding the help files to
\QC, see
\l{http://qt-project.org/doc/qtcreator/creator-help.html#adding-external-documentation}
{Adding External Documentation}.

View File

@@ -86,7 +86,7 @@
from the user or carries special weight.
\li Use quotation marks ("") around variable values. For example,
\gui {Close Project "qtcreator"}.
\uicontrol {Close Project "qtcreator"}.
For consistency, use double quotes to emphasize or set apart file
names, directory names, URLs, and so on, in user visible strings.
@@ -121,14 +121,14 @@
short, canonical HTML in the source tab of the rich text editor:
\c {<html><head/><body><b>Note:</b> text.}
In Qt 4.7, use only the \gui Source tab of the Qt Designer rich text
In Qt 4.7, use only the \uicontrol Source tab of the Qt Designer rich text
editor. The automatic conversion performed by the rich text editor tab
generates a lot of redundant stylesheet information and uses hard-coded
fonts that look bad on other platforms and make translation in Qt Linguist
difficult.
Qt Designer 4.8 has a feature that simplifies the rich text (on by
default), but still, you should verify by looking at the \gui Source tab.
default), but still, you should verify by looking at the \uicontrol Source tab.
\section2 Writing Messages
@@ -197,7 +197,7 @@
\li Enter the UI text in the field.
\li Click \gui Convert.
\li Click \uicontrol Convert.
\endlist
@@ -357,9 +357,9 @@
\image qtcreator-dialog.png "Dialog"
\li Use the menu item or button name as the dialog name. You can
also combine the menu item or button name and the name of the
object that is managed in the dialog. For example, the \gui Add
button in the \gui Documentation options opens the
\gui {Add Documentation} dialog.
object that is managed in the dialog. For example, the \uicontrol Add
button in the \uicontrol Documentation options opens the
\uicontrol {Add Documentation} dialog.
\row
\li Locator
\li Allows you to browse not only files, but any items defined by
@@ -398,7 +398,7 @@
\image qtcreator-mode-selector.png "Mode selector"
\li You can add a mode for a new type of editor, for example.
Use descriptive, but short mode names. They have to fit in the
\gui {Mode selector}.
\uicontrol {Mode selector}.
\row
\li Output pane
\li A pane displayed in the task pane that displays output from Qt Creator.
@@ -406,7 +406,7 @@
\li Use descriptive names for output panes.
\row
\li Sidebar
\li A view available in the \gui Edit and \gui Debug modes that
\li A view available in the \uicontrol Edit and \uicontrol Debug modes that
you can use to browse projects, files, and bookmarks, and to
view the class hierarchy.
\image qtcreator-sidebar-menu.png "Sidebar"
@@ -416,7 +416,7 @@
\li View
\li An area of the screen that displays information for users and
provides them with functions for managing the information.
Available in \gui Debug mode, for interaction with the program
Available in \uicontrol Debug mode, for interaction with the program
that is running under the control of the debugger.
\image qtcreator-debugger-views.png "Views"
\li Use descriptive names for views.

View File

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 104 KiB

View File

@@ -147,7 +147,7 @@
The anddroiddeployqt tool uses the information in the project .pro file to
create APKs. For more information about the qmake variables
that you can set in the .pro file to tailor the APK, see
\l{Deploying an Application on Android#qmake-variables}{qmake Variables}.
\l{Deploying an Application on Android}.
You can view information about what the anddroiddeployqt tool is doing in
the \uicontrol {Compile Output} pane. To view additional information, select the

View File

@@ -198,7 +198,7 @@
{Qt application}, and therefore, it accepts the command line options
that all Qt applications accept. For example, you can use the \c {-style} and
\c {-stylesheet} options to apply custom styles and
\l{QApplication#stylesheet}{stylesheets}.
\l{Qt Style Sheets}{stylesheets}.
The styling is only applied during the current session.
Exercise caution when applying styles, as overriding the existing styling

View File

@@ -24,7 +24,7 @@
/*!
\contentspage {Qt Creator Manual}
\previouspage creator-project-wizards.html
\previouspage creator-project-wizards-xml.html
\page creator-version-control.html
\nextpage creator-configuring-projects.html

View File

@@ -161,7 +161,7 @@
\b {Has a reported issue been addressed?}
You can look up any issue in the
\l{http://bugreports.qt-project.org/}{Qt bug tracker}.
\l{https://bugreports.qt.io/}{Qt bug tracker}.
\include widgets/creator-faq-qtdesigner.qdocinc

View File

@@ -35,7 +35,7 @@
bugs.
For a list of fixed issues and added features, see the changelog file in
the \c{qtcreator\dist} folder or the \l{http://bugreports.qt-project.org}
the \c{qtcreator\dist} folder or the \l{https://bugreports.qt.io}
{Qt Bug Tracker}.
\section1 General Issues
@@ -56,7 +56,7 @@
\li Qt 4.7.4 is known to contain a bug exposed by g++ 4.6 which triggers
a crash in \QC. For more information, see
\l{http://bugreports.qt-project.org/browse/QTBUG-21265}{QTBUG-21265}
\l{https://bugreports.qt.io/browse/QTBUG-21265}{QTBUG-21265}
\li The Okteta KDE custom widget plugin might be installed as part of
some Linux distributions. It can cause Qt Designer to crash. For
@@ -67,7 +67,7 @@
\li \l{http://bugs.launchpad.net/ubuntu/+source/kdeutils/+bug/662005}
{Ubuntu bug 662005}
\li \l{http://bugreports.qt-project.org/browse/QTBUG-12025}
\li \l{https://bugreports.qt.io/browse/QTBUG-12025}
{QTBUG-12025}
\endlist

View File

@@ -322,7 +322,7 @@
Qt provides support for integration with OpenGL implementations on all
platforms, which allows you to display hardware accelerated 3D graphics
alongside a more conventional user interface. For more information, see
\l{Qt Gui#opengl-and-opengl-es-integration}{OpenGL and OpenGL ES integration}.
\l{Qt GUI}.
You can use the QOpenGLShader class to compile OpenGL shaders written in the
OpenGL Shading Language (GLSL) and in the OpenGL/ES Shading Language

View File

@@ -0,0 +1,686 @@
/****************************************************************************
**
** Copyright (c) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator
**
**
** GNU Free Documentation License
**
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of this
** file.
**
**
****************************************************************************/
// **********************************************************************
// NOTE: the sections are not ordered by their logical order to avoid
// reshuffling the file each time the index order changes (i.e., often).
// Run the fixnavi.pl script to adjust the links to the index order.
// **********************************************************************
/*!
\contentspage {Qt Creator Manual}
\previouspage creator-project-wizards.html
\page creator-project-wizards-json.html
\nextpage creator-project-wizards-xml.html
\title Adding JSON-Based Wizards
\image qtcreator-new-qt-gui-application.png
The JSON-based wizards are displayed in the \uicontrol New dialog. To
customize them, copy a directory that contains a wizard.json file in
\c {share/qtcreator/templates/wizards/} and modify it to fit your needs.
After you run qmake and restart \QC, the wizard name appears in the
selected or added category. For each wizard, an icon, a display name, and
a description are displayed.
JSON-based wizard template directories contain a JSON configuration file
called wizard.json and the template files. The configuration file contains
sections that specify information about the wizard, variables that you can
use, wizard pages, and generators for creating files.
\section1 Using Variables in Wizards
You can use variables (\c %{<variableName>}) in the configuration and
template source files. A set of variables is predefined by the wizards and
their pages. You can introduce new variables as shortcuts to be used later.
Define the variable key names and values in the \c options section in the
.json file.
The variables always return strings. In places where a boolean value is
expected and a string is given, an empty string is treated as \c false and
anything else as \c true. A common pitfall is that a string containing
\c "false" is not empty and is therefore treated as the value \c true when
converted to a boolean value. To avoid this pitfall, use the following type
of construction:
\code
{"condition": "%{JS: ('%{VersionControl}' === 'G.Git') ? 'yes' : ''}"
\endcode
\section1 Localizing Wizards
If a setting name starts with the \c tr prefix, the value is visible to
users and should be translated. If the new wizard is included in the \QC
sources, the translatable strings appear in the \QC translation files and
can be translated as a part of \QC. Alternatively, you can place the
translations in the .json file using the following syntax:
\code
"trDisplayName": { "C": "default", "en_US": "english", "de_DE": "deutsch" }
\endcode
For example:
\code
"trDisplayName": { "C": "Project Location", "en_US": "Project Location", "de_DE": "Projekt Verzeichnis" }
\endcode
\section1 Creating Wizards
\QC contains wizards for adding classes, files, and projects. You can
use them as basis for adding your own wizards. We use the C++ wizard
to explain the process and the sections and settings in the .json file.
\image qtcreator-cpp-class-wizard.png
For more information about the pages and widgets that you can add, see
\l {Available Pages} and \l{Available Widgets}.
To create a JSON-based C++ class wizard:
\list 1
\li Make a copy of \c {share/qtcreator/templates/wizards/classes/cpp}
and rename it.
\li Right-click the project name in \uicontrol Projects and select
\uicontrol {Run qmake} to register the new wizard. Basically, qmake
generates a fixed list of files to copy. Therefore, you need to run
qmake each time the names or locations of the files change.
\li Open the wizard configuration file, \c wizard.json for editing:
\list
\li The following settings determine the type of the wizard and
its place in the \uicontrol New dialog:
\code
"version": 1,
"kind": "class",
"id": "A.Class",
"category": "O.C++",
\endcode
\list
\li \c version is the version of the file contents. Do not
modify this value.
\li \c kind specifies the type of the wizard: \c class,
\c file, or \c project.
\li \c id is the unique identifier for your wizard. You can
use a leading letter to specify the position of the
wizard within the \c category.
\li \c category is the category in which to place the wizard
in the list. You can use a leading letter to specify the
position of the category in the list in the
\uicontrol New dialog.
\li \c disabled is set to to \c true to hide the wizard. By
default, it is set to \c{false}.
\endlist
\li The following settings specify the icon and text that appear in
the \uicontrol New dialog:
\code
"trDescription": "Creates a C++ header and a source file for a new class that you can add to a C++ project.",
"trDisplayName": "C++ Class",
"trDisplayCategory": "C++",
"icon": "../../global/genericfilewizard.png",
"featuresRequired": [ "Plugin.CppEditor" ],
\endcode
\list
\li \c trDescription appears in the right-most panel when
\c trDisplayCategory is selected.
\li \c trDisplayName appears in the middle panel when
\c trDisplayCategory is selected.
\li \c trDisplayCategory appears in the \uicontrol New dialog,
under \uicontrol Projects.
\li \c icon appears next to the \c trDisplayName in the middle
panel when \c trDisplayCategory is selected. We recommend
that you specify the path relative to the wizard.json file,
but you can also use an absolute path.
\li \c featuresRequired specifies the \QC features that the
wizard depends on. If a required feature is missing, the
wizard is hidden. For example, if the CppEditor plugin is
disabled, the C++ Class wizard is hidden.
\li \c featuresPreferred specifies the build and run kits to
preselect.
\li \c platformIndependent is set to \c true if the wizard is
supported by all target platforms. By default, it is set to
\c{false}.
\endlist
\li The \c options section contains an array of objects with \e key
and \e value attributes. You can define your own variables to
use in the configuration and template source files, in addition
to the predefined variables. For example, the following
variables are used in the C++ class creation wizard:
\code
"options":
[
{ "key": "TargetPath", "value": "%{Path}" },
{ "key": "HdrPath", "value": "%{Path}/%{HdrFileName}" },
{ "key": "SrcPath", "value": "%{Path}/%{SrcFileName}" },
{ "key": "CN", "value": "%{JS: Cpp.className('%{Class}')}" },
{ "key": "Base", "value": "%{JS: ( '%{BaseCB}' === '' ) ? '%{BaseEdit}' : '%{BaseCB}'}" },
{ "key": "isQObject", "value": "%{JS: ('%{Base}' === 'QObject' || '%{Base}' === 'QWidget' || '%{Base}' === 'QMainWindow' || '%{Base}' === 'QDeclarativeItem' || '%{Base}' === 'QQuickItem' ) ? 'yes' : ''}" },
{ "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" },
{ "key": "SharedDataInit", "value": "%{JS: ('%{IncludeQSharedData}') ? 'data(new %{CN}Data)' : '' }" }
],
\endcode
This section is optional. For more examples of variables, see
the wizard.json files for other wizards.
\li The \c pages section specifies the wizard pages. The pages
used depend on the wizard type. You can add standard pages to
wizards or create new pages using the available widgets. The
following settings specify the display name, title, and type of
the page:
\code
"pages":
[
{
"trDisplayName": "Define Class",
"trShortTitle": "Details",
"typeId": "Fields",
"data" :
[
{
"name": "Class",
"trDisplayName": "Class name:",
"mandatory": true,
"type": "LineEdit",
"data": { "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)+[a-zA-Z_][a-zA-Z_0-9]*|)" }
},
...
]
\endcode
\list
\li \c typeId specifies the page to use: \c Fields, \c File,
\c Form, \c Kits, \c Project, or \c Summary. Full page
ID, as used in the code, consists of the \c typeId
prefixed with \c {"PE.Wizard.Page."}. For more
information, about the pages, see \l{Available Pages}.
\li \c trDisplayName specifies the title of the page. By
default, the page title is used.
\li \c trShortTitle specifies the title used in the sidebar
of the Wizard. By default, the page title is used.
\li \c trSubTitle specifies the subtitle of the page. By
default, the page title is used.
\li \c index is an integer value that specifies the page ID.
It is automatically assigned if you do not set it.
\li \c enabled is set to \c true to show the page and to
\c false to hide it.
\li \c data specifies the wizard pages. In the C++ wizard,
it specifies a \c Fields page and a \c Summary page. The
\c Fields page contains the \c CheckBox, \c ComboBox,
\c LineEdit, \c PathChooser, and \c Spacer widgets. For
more information about the widgets, see
\l{Available Widgets}.
\endlist
\li The \c generators section specifies the files to be added to the
project:
\code
"generators":
[
{
"typeId": "File",
"data":
[
{
"source": "file.h",
"target": "%{HdrPath}",
"openInEditor": true
},
{
"source": "file.cpp",
"target": "%{SrcPath}",
"openInEditor": true
}
]
\endcode
\list
\li \c typeId specifies the type of the generator. Currently,
only \c File is supported.
\li \c data spefices the files to generate. For a each file
to be generated, specify the following values:
\list
\li \c source specifies the path and filename of the
template file relative to the wizard.json file.
\li \c target specifies the location of the generated
file, either absolute or relative to
\c %{TargetPath}, which is usually set by one of the
wizard pages.
\li \c openInEditor opens the file in the appropriate
editor if it is set to \c{true}.
\li \c openAsProject opens the project file in \QC if it
is set to \c{true}.
\li \c condition generates the file if the condition
returns \c{true}. For more information, see
\l{Using Variables in Wizards}.
\endlist
\endlist
\endlist
\endlist
\section1 Available Pages
You can add predefined pages to wizards by specifying them in the \c pages
section of a wizard.json file.
\section2 Field Page
A Field page has the \c typeId value \c Field and contains widgets. For more
information about widget definitions, see \l{Available Widgets}.
\code
"pages":
[
{
"trDisplayName": "Define Class",
"trShortTitle": "Details",
"typeId": "Fields",
"data" :
[
{
"name": "Class",
"trDisplayName": "Class name:",
"mandatory": true,
"type": "LineEdit",
"data": { "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)+[a-zA-Z_][a-zA-Z_0-9]*|)" }
},
...
],
\endcode
\section2 File Page
A File page has the \c typeId value \c File. You can leave out the \c data
key or assign an empty object to it.
\code
{
"trDisplayName": "Location",
"trShortTitle": "Location",
"typeId": "File"
},
\endcode
The page evaluates \c InitialFileName and \c InitialPath from the wizard to
set the initial path and filename. The page sets \c TargetPath to the full
path of the file to be created.
\section2 Form Page
A Form page has the \c typeId value \c Form. You can leave out the \c data
key or assign an empty object to it.
\code
{
"trDisplayName": "Choose a Form Template",
"trShortTitle": "Form Template",
"typeId": "Form"
},
\endcode
The page sets \c FormContents to an array of strings with the form contents.
\section2 Kits
A Kits page has the \c typeId value \c Kits. The \c data section of a Kits
page contains an object with the field \c projectFilePath set.
\code
{
"trDisplayName": "Kit Selection",
"trShortTitle": "Kits",
"typeId": "Kits",
"enabled": "%{IsTopLevelProject}",
"data": { "projectFilePath": "%{ProFileName}" }
},
\endcode
The page evaluates \c Platform to set the platform selected in
\uicontrol File > \uicontrol New, \c PreferredFeatures to set the preferred
features for the project, and \c RequiredFeatures to set the required
features for the project. The feature set is used to determine which kits to
display and pre-select for the project.
\section2 Project
A Project page has the \c typeId value \c Project. It contains no data or an
empty object.
\code
{
"trDisplayName": "Project Location",
"trShortTitle": "Location",
"typeId": "Project"
},
\endcode
The page evaluates \c InitialPath to set the initial project path. The page
sets \c ProjectDirectory and \c TargetPath to the project directory.
\section2 Summary
A Summary page has the \c typeId value \c Summary. It contains no data or
an empty object.
\code
{
"trDisplayName": "Project Management",
"trShortTitle": "Summary",
"typeId": "Summary"
}
\endcode
The page sets \c IsSubproject to an empty string if this is a toplevel
project and to \c yes otherwise. It sets \c VersionControl to the ID of the
version control system in use.
\section1 Available Widgets
You can add the following widgets on a Field page:
\list
\li Check Box
\li Combo Box
\li Label
\li Line Edit
\li Path Chooser
\li Spacer
\li Text Edit
\endlist
Specify the following settings for each widget:
\list
\li \c name specifies the widget name. This name is used as the variable
name to access the value again.
\li \c trDisplayName specifies the label text visible in the UI (if
\c span is not \c true).
\li \c type specifies the type of the widget: \c CheckBox, \c ComboBox,
\c Label, \c LineEdit, \c PathChooser, \c Spacer, and \c TextEdit.
\li \c data specifies settings for the widget:
\list
\li \c visible is set to \c true if the widget is visible, otherwise
it is set to \c false. By default, it is set to \c true.
\li \c enabled is set to \c true if the widget is enabled, otherwise
it is set to \c false. By default, it is set to \c true.
\li \c mandatory is set to \c true if this widget must have a value
for the \uicontrol Next button to become enabled. By default, it
is set to \c true.
\li \c span is set to hide the label and to span the form. By
default, it is set to \c false. For more information, see
\l{Using Variables in Wizards}.
\endlist
The additional settings available for a particular widget are described
in the following sections.
\endlist
\section2 Check Box
\code
{
"name": "IncludeQObject",
"trDisplayName": "Include QObject",
"type": "CheckBox",
"data":
{
"checkedValue": "QObject",
"uncheckedValue": "",
"checked": "%{JS: ('%{BaseCB}' === 'QObject' ) ? 'yes' : ''}"
}
},
\endcode
\list
\li \c checkedValue specifies the value to set when the check box is
enabled. By default, set to \c 0.
\li \c uncheckedValue specifies the value to set when the check box is
disabled. By default, set to \c 1.
\li \c checked is set to \c true if the check box is enabled, otherwise
\c{false}.
\endlist
\section2 Combo Box
\code
{
"name": "BaseCB",
"trDisplayName": "Base class:",
"type": "ComboBox",
"data":
{
"items": [ { "trKey": "<Custom>", "value": "" },
"QObject", "QWidget", "QMainWindow", "QDeclarativeItem", "QQuickItem" ]
}
},
\endcode
\list
\li \c items specifies a list of items to put into the combo box. The
list can contain both JSON objects and plain strings. For JSON
objects, define \c trKey and \c value pairs, where the \c trKey is
the list item visible to users and \c value contains the data
associated with the item.
\li \c index specifies the index to select when the combo box is
enabled. By default, it is set to \c 0.
\li \c disabledIndex specifies the index to show if the combo box is
disabled.
\endlist
\section2 Label
\code
{
"name": "LabelQQC_1_0",
"type": "Label",
"span": true,
"visible": "%{( '%{CS}' === 'QQC_1_0' ) ? 'yes' : ''}",
"data":
{
"wordWrap": true,
"trText": "Creates a deployable Qt Quick 2 application using Qt Quick Controls. Requires Qt 5.1 or newer."
}
},
\endcode
\list
\li \c wordWrap is set to \c true to enable word wrap. By default, it is
set to \c{false}.
\li \c trText contains the label text to display.
\endlist
\section2 Line Edit
\code
{
"name": "Class",
"trDisplayName": "Class name:",
"mandatory": true,
"type": "LineEdit",
"data": { "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)+[a-zA-Z_][a-zA-Z_0-9]*|)" }
},
{
"name": "BaseEdit",
"type": "LineEdit",
"enabled": "%{JS: ( '%{BaseCB}' === '' ) ? 'yes' : ''}",
"mandatory": false,
"data":
{
"trText": "%{BaseCB}",
"trDisabledText": "%{BaseCB}"
}
},
\endcode
\list
\li \c trText specifies the default text to display.
\li \c trDisabledText specifies the text to display in a disabled field.
\li \c trPlaceholder specifies the placeholder text.
\li \c validator specifies a QRegularExpression to validate the line
edit against.
\li \c fixup specifies a variable that is used to fix up the string.
For example, to turn the first character in the line edit to upper
case.
\endlist
\section2 Path Chooser
\code
{
"name": "Path",
"type": "PathChooser",
"trDisplayName": "Path:",
"mandatory": true,
"data":
{
"kind": "existingDirectory",
"basePath": "%{InitialPath}",
"path": "%{InitialPath}"
}
},
\endcode
\list
\li \c path specifies the selected path.
\li \c basePath specifies a base path that lookups are relative to.
\li \c kind defines what to look for: \c existingDirectory,
\c directory, \c file, \c saveFile, \c existingCommand, \c command,
or \c any.
\endlist
\section2 Spacer
\code
{
"name": "Sp1",
"type": "Spacer",
"data":
{
"factor": 2
}
},
\endcode
The \c factor setting specifies the factor (an integer) to multiply the
layout spacing for this spacer.
\section2 Text Edit
\code
{
"name": "TextField",
"type": "TextEdit",
"data" :
{
"trText": "This is some text",
"richText": true
}
}
\endcode
\list
\li \c trText specifies the text to display.
\li \c trDisabledText specifies the text to display when the text edit
is disabled.
\li \c richText is set to \c true for rich text, otherwise \c{false}.
\endlist
*/

View File

@@ -0,0 +1,637 @@
/****************************************************************************
**
** Copyright (c) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator
**
**
** GNU Free Documentation License
**
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of this
** file.
**
**
****************************************************************************/
// **********************************************************************
// NOTE: the sections are not ordered by their logical order to avoid
// reshuffling the file each time the index order changes (i.e., often).
// Run the fixnavi.pl script to adjust the links to the index order.
// **********************************************************************
/*!
\contentspage {Qt Creator Manual}
\previouspage creator-project-wizards-json.html
\page creator-project-wizards-xml.html
\nextpage creator-version-control.html
\title Adding XML-Based Wizards
To display the XML-based example wizards in \QC, rename wizard_sample.xml as wizard.xml in the
\c {\share\qtcreator\templates\wizards\helloworld} and
\c {\share\qtcreator\templates\wizards\listmodel} folders. After
you restart \QC, the \uicontrol {Custom Classes}
and \uicontrol {Custom Projects} categories (1) appear in the \uicontrol New dialog. For
each category, an icon (2), a display name (3), and a description (4) are
displayed.
\image qtcreator-custom-project-wizards.png "The New dialog with custom projects and classes"
Files can be generated by using either \l{Processing Template Files}
{templates} or \l{Using Generator Scripts}{generator scripts}, where a
script is called to create the files.
\note The generator option mainly exists to accommodate existing generator
scripts or cases where complicated algorithmic logic is required when
generating files. Writing cross-platform scripts is inherently difficult,
and therefore, it is not recommended for new wizards.
XML-based wizard template directories contain an XML configuration file
called wizard.xml, the template source files, and optionally, the generator
script.
\section1 Creating XML-Based Project Wizards
To create an XML-based project wizard:
\list 1
\li Make a copy of the \c {share/qtcreator/templates/wizards/helloworld}
or \c {share/qtcreator/templates/wizards/listmodel} folder.
\li Modify the wizard_example.xml file.
\li The following code determines the type of the wizard and its place
in the \uicontrol New dialog:
\code
<wizard version="1" kind="project"
class="qmakeproject" firstpage="10"
id="A.HelloWorld" category="B.CustomProjects">
\endcode
\list
\li \c version is the version of the file contents. Do not modify
this value.
\li \c kind specifies the type of the wizard: \c project or
\c class.
\li \c class specifies the type of the project. This attribute is
optional. Use the value \c qmakeproject to add Qt specific pages.
\li \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.
\li \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 \uicontrol New dialog.
\li \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 \uicontrol New dialog.
\endlist
\li The following code specifies the icon and text that appear in the
\uicontrol 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
\li \c displayCategory appears in the \uicontrol New dialog, under
\uicontrol Projects.
\li \c icon appears next to the \c displayName in the middle panel
when \c displayCategory is selected.
\li \c description appears in the right-most panel when
\c displayCategory is selected.
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
\li Files to be added to the project:
\list
\li Template-based: 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" />
<file source="icon.png" target="%ProjectName%.png" binary="true" />
\endcode
\list
\li \c source specifies the file to copy to the project. The
files must be located in the wizard folder.
\li \c openeditor indicates that the file is to be opened in an
editor after the wizard has finished.
\li \c binary indicates that the file is a binary file (for
example, an image file). It is to be copied to the target
folder as is. Placeholders are not replaced with values.
\li \c target specifies the new filename for the file. The
\c {%ProjectName%} variable is replaced with the string that
users specify in the \uicontrol Name field on the first page of
the wizard.
\li \c openproject indicates that the file is a project file
which is to be opened after the wizard has finished.
\endlist
See also \l{Processing Template Files}.
\li Generator-script: The following code specifies that the script
\c generate.pl is to be used to create the files:
\code
<generatorscript binary="generate.pl">
<argument value="--class-name=%ClassName%"/>
<argument value="--project-name=%ProjectName%"/>
<argument value="--header-suffix=%CppHeaderSuffix%" omit-empty="true"/>
<argument value="--source-suffix=%CppSourceSuffix%" omit-empty="true"/>
<argument value="--description=%Description%" omit-empty="true" write-file="true"/>
</generatorscript>
\endcode
In each argument, the field placeholders are replaced by the
field values. There are additional boolean attributes which give
fine-grained control:
\list
\li \c omit-empty specifies that complete argument is to be
omitted when all placeholders expand to empty values. In
the above example, the option \c --source-suffix will
not be passed to the script if the value is empty.
\li \c write-file indicates that instead of the expanded
value, the value will be written to a temporary file and
its file name will be passed to the script instead. This
is useful for multi-line text fields.
\endlist
See also \l{Using Generator Scripts}.
\endlist
\li 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!" placeholdertext="Enter a message"/>
<fielddescription>Hello world message:</fielddescription>
<fielddescription xml:lang="de">Hallo-Welt-Nachricht:</fielddescription>
</field>
</fields>
\endcode
\list
\li \c fieldpagetitle specifies the title of the page.
\li \c fields specifies the user interface objects on the page.
\li \c field specifies one object. You can use a set of interface objects
from QtWidgets classes, derived from QWidget, to create fields. This example
uses QLineEdit to create an input field. For more information about the objects
that you can add, see \l {Supported Widgets}.
\li \c mandatory specifies whether the field is mandatory (\c true or
\c false). For more information, see QWizardPage::registerField().
\li \c name specifies a name that you can use as a placeholder variable in the
template file (for example, \c {%MESSAGE%}).
\li \c class specifies the type of the \c fieldcontrol. The XML attributes that you
can specify for the field depend on the field type.
\li For a QLineEdit, \c validator specifies a regular expression to check the
characters allowed in the field.
\li \c defaulttext specifies text that appears in the field by
default.
\li For a QLineEdit, \c placeholdertext specifies placeholder text that appears in the
field.
\li \c fielddescription specifies the field name that appears on the
wizard page.
\endlist
\endlist
\section1 Creating Class Wizards
The wizard.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
\li 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 XML-Based Project Wizards}.
\li 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
\li \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.
\li \c {%CppSourceSuffix%} and \c {%CppHeaderSuffix%} are
pre-defined. For more information, see
\l{Pre-defined Standard Variables}.
\endlist
\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" defaultindex="0">
<comboentries>
<comboentry value="QString">
<comboentrytext>class QString</comboentrytext>
<comboentrytext xml:lang="de">Klasse QString</comboentrytext>
</comboentry>
<comboentry value="int">
<comboentrytext>Integer</comboentrytext>
<comboentrytext xml:lang="de">Ganzzahlwert</comboentrytext>
</comboentry>
</comboentries>
</fieldcontrol>
<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. Specify the following XML attributes:
\list
\li \c defaultindex specifies which comboentry is displayed by default. In the above
example, "0" means that the first comboentry is the default value.
\li \c comboentries specifies the options in the combobox.
\li \c value specifies the type of each \c comboentry, QString or integer.
\li \c comboentrytext specifies the text of the entry.
\endlist
\endlist
\section1 Supported Widgets
You can use the following interface objects to create fields in the wizards:
\list
\li PathChooser utility to set paths
\li Check boxes with text labels (QCheckBox)
\li Combined button and popup lists (QComboBox)
\li One-line text editors (QLineEdit)
\li Multi-line rich text editors (QTextEdit)
\endlist
Using QLineEdit and QComboBox is described in the previous sections.
The following sections show examples of using the other classes and describe the XML
attributes that you can specify for the \c fieldcontrol element of a field in a particular
\c class.
\section2 Path Choosers
\code
<field mandatory="true" name="QtCreatorSources">
<fieldcontrol class="Utils::PathChooser" defaulttext="" expectedkind="existingdirectory"/>
<fielddescription>Qt Creator sources:</fielddescription>
</field>
\endcode
The \c defaulttext attribute specifies text that appears in the field by default.
The text attribute \c expectedkind specifies which type of path is expected:
\list
\li \c any accepts any kind of path.
\li \c file expects a file.
\li \c directory expects a directory.
\li \c existingdirectory expects an existing directory.
\li \c command expects an executable file.
\li \c existingcommand expects an existing, executable file.
\endlist
\section2 Check Boxes
To make check boxes appear selected by default, set the \c fieldcontrol attribute
\c defaultvalue to \c true. Any other value or omitting the attribute makes the check box
appear not selected.
For example:
\code
<field name="CONSOLE">
<fieldcontrol class="QCheckBox" defaultvalue="true"/>
<fielddescription>Console application</fielddescription>
</field>
\endcode
For more examples about using check boxes, see \l{Processing Template Files}.
\section2 Text Editors
\code
<field name="License">
<fieldcontrol class="QTextEdit" defaulttext="Put your license text here" />
<fielddescription>License:</fielddescription>
</field>
\endcode
The \c defaulttext attribute specifies text that appears in the field by default.
The boolean attribute \c acceptRichText sets the property QTextEdit::acceptRichText.
It is disabled by default (as opposed to the default value of QTextEdit::acceptRichText)
to prevent pasting of rich text with formatting, which is not desirable for code templates.
\section1 Processing Template Files
When processing a template source file, placeholders specifying the field
names in the format \c{%FIELDNAME%} are replaced by the values entered by
the user. In addition, modifier characters are supported. For example,
\c{%FIELDNAME:u%} specifies that the value is converted to upper case. This
enables generating header guards for C++ header files.
The following modifier characters are supported:
\list
\li \c{l} for lower case.
\li \c{u} for upper case.
\li \c{c} for upper case initial letter ("project" > "Project").
\endlist
In the \c{helloworld} example, the placeholder \c %NETWORK% is used together with the
QCheckBox class. The following line is added to the project file:
\code
%NETWORK%QT += network
\endcode
And the following field is specified in the wizard.xml:
\code
<field name="NETWORK">
<fieldcontrol class="QCheckBox" truevalue="" falsevalue="# "/>
<fielddescription>Include network module</fielddescription>
<fielddescription xml:lang="de">Netzwerk-Modul verwenden</fielddescription>
</field>
\endcode
If the checkbox is checked, the placeholder is replaced by \c truevalue. If it is not
checked, the placeholder is replaced by \c falsevalue.
You can use conditions to add sections of the file depending on field
values. Use a syntax that is similar to C++ preprocessing, as demonstrated
in the project file of the \c{helloworld} example:
\code
@if "%SCRIPT%" == "true"
QT += script
@endif
\endcode
The value of the Boolean (QCheckBox) field labeled \c{SCRIPT} determines
whether the script module is added. The expressions must expand to valid
Javascript expressions after field replacement.
For example, the following field is specified in the wizard.xml:
\code
<field name="SCRIPT">
<fieldcontrol class="QCheckBox"/>
<fielddescription>Include script module</fielddescription>
<fielddescription xml:lang="de">Script-Modul verwenden</fielddescription>
</field>
\endcode
\section1 Pre-defined Standard Variables
In addition to the field values entered by the user, you can use
the following pre-defined standard values:
\list
\li \c {%ProjectName%} is replaced by the name of the project in the
case of project wizards.
\li \c {%Path%} is replaced by the path to the target directory. For
classes, this is the directory, where the files are created. For
project wizards, an additional subdirectory named after the project
is created.
\li \c {%TargetPath%} is replaced by the path to the directory where the
actual files are created. For non-project wizards, it is identical
to \c %Path%. For project wizards, it is \c %Path%/%ProjectName%.
\li \c {%CppSourceSuffix%} is replaced by the default source suffix,
which is defined in \QC in \uicontrol {Tools > Options > C++ >
File Naming}. For example, if users enter \b MyClass, the
filename becomes myclass.cpp when the project is created.
\li \c {%CppHeaderSuffix%} is replaced by the default header suffix,
which is also defined in \uicontrol {File Naming}.
\li \c {%CurrentDate%} is replaced by the current date in the format
\c {YYYY-MM-DD} as specified by ISO 8601.
\li \c {%CurrentTime%} is replaced by the current time in the format
\c {HH:MM:SS} as specified by ISO 8601.
\li \c {%CurrentDate:Locale%} is replaced by the current date in the short format
specified by the application's locale.
\li \c {%CurrentTime:Locale%} is replaced by the current time in the short format
specified by the application's locale.
\li \c {%CurrentDate:ISO%} is replaced by the current date in the format
\c {YYYY-MM-DD} as specified by ISO 8601.
\li \c {%CurrentTime:ISO%} is replaced by the current time in the format
\c {HH:MM:SS} as specified by ISO 8601.
\li \c {%CurrentDate:RFC%} is replaced by the current date in the format
\c {DD Mon YYYY}, where \c {Mon} is the three letter month name, as specified by RFC 2822.
\li \c {%CurrentTime:RFC%} is replaced by the current time in the format
\c {HH:MM:SS} as specified by RFC 2822.
\endlist
\section1 Validating User Input
You can specify validation rules for user input. The rules consist of a
Boolean JavaScript expression and an error message. The placeholders in them
are replaced with values before they are evaluated or displayed.
Consider the following rule used in the \l{Creating Class Wizards} example:
\code
<validationrules>
<validationrule condition='"%ClassName%" != "QAbstractListModel"'>
<message>%ClassName% cannot be used as class name.</message>
<message xml:lang="de">%ClassName% kann nicht als Klassenname verwendet werden.</message>
</validationrule>
</validationrules>
\endcode
It ensures that the class name entered by the user does not match the name
of the base class. If the validation fails, a red label displaying the
message appears at the bottom of the wizard page.
\section1 Using Generator Scripts
The values entered in the wizard page are passed to the script
as command line arguments as defined by the wizard configuration file.
In addition, the script must implement a \c{--dry-run} command line option.
\QC needs to know the file names before the files are created to check
whether files with identical names already exist, for example. Therefore,
script file generation is a two-step process:
\list 1
\li Determine file names and attributes: The script is called with the
command line \c{--dry-run} option and the field values. It then prints
the relative path names of the files it intends to create, followed by
comma-separated attributes matching those of the \c{<file>} element, for
example:
\code
myclass.cpp,openeditor
myclass.h,openeditor
myproject.pro,openproject
\endcode
\li Create files: The script is called with the parameters only in the
working directory. It then actually creates the files. If directories
are needed, the script should create them, too.
\endlist
The \c{scriptgeneratedproject} sample wizard illustrates the usage.
A typical script invocation for this example (obtained by running \QC with
\c{--customwizard-verbose}) looks as follows:
\code
generate.pl --class-name=TestClass --project-name=TestProject --header-suffix=h --source-suffix=cpp --description=/tmp/qtcreatorj26629.txt
\endcode
By default, the scripts are run in the directory corresponding to
\c %TargetPath%. This can be overridden by specifying the attribute
\c workingdirectory on the element \c generatorscript. For example, if the
script creates the project directory by itself, %Path% can be specified. In
that case, \c --dry-run should output the correct relative paths or absolute
paths constructed using the value of \c %Path%.
*/

View File

@@ -26,17 +26,23 @@
\contentspage {Qt Creator Manual}
\previouspage creator-project-qmake-libraries.html
\page creator-project-wizards.html
\nextpage creator-version-control.html
\nextpage creator-project-wizards-json.html
\title Adding New Custom 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 might want to standardize the way the team members create projects,
classes, and files.
You can copy the wizard templates in the template folders to create your own
project and class wizards. They are displayed in the \uicontrol New dialog that
opens when you choose \uicontrol {File > New File or Project}.
project, class, and file wizards. They are displayed in the \uicontrol New
dialog that opens when you choose \uicontrol {File > New File or Project}.
A custom wizard defines the user interface of a wizard page. The values the
user enters in the wizard are assigned field names. Field name and value
pairs are then passed to the file creation process.
\section1 Wizard Types
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
@@ -45,42 +51,41 @@
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_sample.xml as wizard.xml in the
\c {\share\qtcreator\templates\wizards\helloworld} and
\c {\share\qtcreator\templates\wizards\listmodel} folders. After
you restart \QC, the \uicontrol {Custom Classes}
and \uicontrol {Custom Projects} categories (1) appear in the \uicontrol New dialog. For
each category, an icon (2), a display name (3), and a description (4) are
displayed.
In a file wizard, you can allow developers to specify the type and location
of the file.
\image qtcreator-custom-project-wizards.png "The New dialog with custom projects and classes"
\section1 Overview of Custom Wizards
A custom wizard defines the user interface of a wizard page. The values the
user enters in the wizard are assigned field names. Field name and value
pairs are then passed to the file creation process. File creation can happen
in the following ways:
\list 1
\li Template-based, where source files that contain placeholders for
the field names are provided. During processing, the placeholders
are replaced by the values from the wizard page. Optionally,
modifier characters are applied. For more information, see
\l{Processing Template Files}.
\li Generator script, where a script is called to create the files.
\note This option mainly exists to accommodate existing generator
scripts or cases where complicated algorithmic logic is required
when generating files. Writing cross-platform scripts is inherently
difficult, and therefore, it is not recommended for new wizards. For
more information, see \l{Using Generator Scripts}.
You can create either JSON-based or XML-based wizards. We recommend creating
JSON-based wizards for new projects. For more information, see:
\list
\li \l{Adding JSON-Based Wizards}
\li \l{Adding XML-Based Wizards}
\endlist
Custom wizards are located in subdirectories of the following directories:
The following table summarizes the wizards you can create:
\table
\header
\li Wizard Type
\li JSON-Based
\li XML-Based
\row
\li Class
\li \image ok
\li \image ok
\row
\li File
\li \image ok
\li \image ok
\row
\li Project
\li \image ok
\li \image ok
\endtable
\section1 Locating Wizards
Wizards are located in subdirectories of the following directories:
\list
@@ -93,588 +98,4 @@
\endlist
They contain an XML configuration file called wizard.xml, the template
source files, and optionally, the generator script.
\section1 Creating Project Wizards
To create a project wizard:
\list 1
\li Make a copy of the \c {share/qtcreator/templates/wizards/helloworld}
or \c {share/qtcreator/templates/wizards/listmodel} folder.
\li Modify the wizard_example.xml file.
\li The following code determines the type of the wizard and its place
in the \uicontrol New dialog:
\code
<wizard version="1" kind="project"
class="qmakeproject" firstpage="10"
id="A.HelloWorld" category="B.CustomProjects">
\endcode
\list
\li \c version is the version of the file contents. Do not modify
this value.
\li \c kind specifies the type of the wizard: \c project or
\c class.
\li \c class specifies the type of the project. This attribute is
optional. Use the value \c qmakeproject to add Qt specific pages.
\li \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.
\li \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 \uicontrol New dialog.
\li \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 \uicontrol New dialog.
\endlist
\li The following code specifies the icon and text that appear in the
\uicontrol 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
\li \c displayCategory appears in the \uicontrol New dialog, under
\uicontrol Projects.
\li \c icon appears next to the \c displayName in the middle panel
when \c displayCategory is selected.
\li \c description appears in the right-most panel when
\c displayCategory is selected.
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
\li Files to be added to the project:
\list
\li Template-based: 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" />
<file source="icon.png" target="%ProjectName%.png" binary="true" />
\endcode
\list
\li \c source specifies the file to copy to the project. The
files must be located in the wizard folder.
\li \c openeditor indicates that the file is to be opened in an
editor after the wizard has finished.
\li \c binary indicates that the file is a binary file (for
example, an image file). It is to be copied to the target
folder as is. Placeholders are not replaced with values.
\li \c target specifies the new filename for the file. The
\c {%ProjectName%} variable is replaced with the string that
users specify in the \uicontrol Name field on the first page of
the wizard.
\li \c openproject indicates that the file is a project file
which is to be opened after the wizard has finished.
\endlist
See also \l{Processing Template Files}.
\li Generator-script: The following code specifies that the script
\c generate.pl is to be used to create the files:
\code
<generatorscript binary="generate.pl">
<argument value="--class-name=%ClassName%"/>
<argument value="--project-name=%ProjectName%"/>
<argument value="--header-suffix=%CppHeaderSuffix%" omit-empty="true"/>
<argument value="--source-suffix=%CppSourceSuffix%" omit-empty="true"/>
<argument value="--description=%Description%" omit-empty="true" write-file="true"/>
</generatorscript>
\endcode
In each argument, the field placeholders are replaced by the
field values. There are additional boolean attributes which give
fine-grained control:
\list
\li \c omit-empty specifies that complete argument is to be
omitted when all placeholders expand to empty values. In
the above example, the option \c --source-suffix will
not be passed to the script if the value is empty.
\li \c write-file indicates that instead of the expanded
value, the value will be written to a temporary file and
its file name will be passed to the script instead. This
is useful for multi-line text fields.
\endlist
See also \l{Using Generator Scripts}.
\endlist
\li 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!" placeholdertext="Enter a message"/>
<fielddescription>Hello world message:</fielddescription>
<fielddescription xml:lang="de">Hallo-Welt-Nachricht:</fielddescription>
</field>
</fields>
\endcode
\list
\li \c fieldpagetitle specifies the title of the page.
\li \c fields specifies the user interface objects on the page.
\li \c field specifies one object. You can use a set of interface objects
from QtWidgets classes, derived from QWidget, to create fields. This example
uses QLineEdit to create an input field. For more information about the objects
that you can add, see \l {Supported Widgets}.
\li \c mandatory specifies whether the field is mandatory (\c true or
\c false). For more information, see QWizardPage::registerField().
\li \c name specifies a name that you can use as a placeholder variable in the
template file (for example, \c {%MESSAGE%}).
\li \c class specifies the type of the \c fieldcontrol. The XML attributes that you
can specify for the field depend on the field type.
\li For a QLineEdit, \c validator specifies a regular expression to check the
characters allowed in the field.
\li \c defaulttext specifies text that appears in the field by
default.
\li For a QLineEdit, \c placeholdertext specifies placeholder text that appears in the
field.
\li \c fielddescription specifies the field name that appears on the
wizard page.
\endlist
\endlist
\section1 Creating Class Wizards
The wizard.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
\li 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}.
\li 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
\li \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.
\li \c {%CppSourceSuffix%} and \c {%CppHeaderSuffix%} are
pre-defined. For more information, see
\l{Pre-defined Standard Variables}.
\endlist
\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" defaultindex="0">
<comboentries>
<comboentry value="QString">
<comboentrytext>class QString</comboentrytext>
<comboentrytext xml:lang="de">Klasse QString</comboentrytext>
</comboentry>
<comboentry value="int">
<comboentrytext>Integer</comboentrytext>
<comboentrytext xml:lang="de">Ganzzahlwert</comboentrytext>
</comboentry>
</comboentries>
</fieldcontrol>
<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. Specify the following XML attributes:
\list
\li \c defaultindex specifies which comboentry is displayed by default. In the above
example, "0" means that the first comboentry is the default value.
\li \c comboentries specifies the options in the combobox.
\li \c value specifies the type of each \c comboentry, QString or integer.
\li \c comboentrytext specifies the text of the entry.
\endlist
\endlist
\section1 Supported Widgets
You can use the following interface objects to create fields in the wizards:
\list
\li PathChooser utility to set paths
\li Check boxes with text labels (QCheckBox)
\li Combined button and popup lists (QComboBox)
\li One-line text editors (QLineEdit)
\li Multi-line rich text editors (QTextEdit)
\endlist
Using QLineEdit and QComboBox is described in the previous sections.
The following sections show examples of using the other classes and describe the XML
attributes that you can specify for the \c fieldcontrol element of a field in a particular
\c class.
\section2 Path Choosers
\code
<field mandatory="true" name="QtCreatorSources">
<fieldcontrol class="Utils::PathChooser" defaulttext="" expectedkind="existingdirectory"/>
<fielddescription>Qt Creator sources:</fielddescription>
</field>
\endcode
The \c defaulttext attribute specifies text that appears in the field by default.
The text attribute \c expectedkind specifies which type of path is expected:
\list
\li \c any accepts any kind of path.
\li \c file expects a file.
\li \c directory expects a directory.
\li \c existingdirectory expects an existing directory.
\li \c command expects an executable file.
\li \c existingcommand expects an existing, executable file.
\endlist
\section2 Check Boxes
To make check boxes appear selected by default, set the \c fieldcontrol attribute
\c defaultvalue to \c true. Any other value or omitting the attribute makes the check box
appear not selected.
For example:
\code
<field name="CONSOLE">
<fieldcontrol class="QCheckBox" defaultvalue="true"/>
<fielddescription>Console application</fielddescription>
</field>
\endcode
For more examples about using check boxes, see \l{Processing Template Files}.
\section2 Text Editors
\code
<field name="License">
<fieldcontrol class="QTextEdit" defaulttext="Put your license text here" />
<fielddescription>License:</fielddescription>
</field>
\endcode
The \c defaulttext attribute specifies text that appears in the field by default.
The boolean attribute \c acceptRichText sets the property QTextEdit::acceptRichText.
It is disabled by default (as opposed to the default value of QTextEdit::acceptRichText)
to prevent pasting of rich text with formatting, which is not desirable for code templates.
\section1 Processing Template Files
When processing a template source file, placeholders specifying the field
names in the format \c{%FIELDNAME%} are replaced by the values entered by
the user. In addition, modifier characters are supported. For example,
\c{%FIELDNAME:u%} specifies that the value is converted to upper case. This
enables generating header guards for C++ header files.
The following modifier characters are supported:
\list
\li \c{l} for lower case.
\li \c{u} for upper case.
\li \c{c} for upper case initial letter ("project" > "Project").
\endlist
In the \c{helloworld} example, the placeholder \c %NETWORK% is used together with the
QCheckBox class. The following line is added to the project file:
\code
%NETWORK%QT += network
\endcode
And the following field is specified in the wizard.xml:
\code
<field name="NETWORK">
<fieldcontrol class="QCheckBox" truevalue="" falsevalue="# "/>
<fielddescription>Include network module</fielddescription>
<fielddescription xml:lang="de">Netzwerk-Modul verwenden</fielddescription>
</field>
\endcode
If the checkbox is checked, the placeholder is replaced by \c truevalue. If it is not
checked, the placeholder is replaced by \c falsevalue.
You can use conditions to add sections of the file depending on field
values. Use a syntax that is similar to C++ preprocessing, as demonstrated
in the project file of the \c{helloworld} example:
\code
@if "%SCRIPT%" == "true"
QT += script
@endif
\endcode
The value of the Boolean (QCheckBox) field labeled \c{SCRIPT} determines
whether the script module is added. The expressions must expand to valid
Javascript expressions after field replacement.
For example, the following field is specified in the wizard.xml:
\code
<field name="SCRIPT">
<fieldcontrol class="QCheckBox"/>
<fielddescription>Include script module</fielddescription>
<fielddescription xml:lang="de">Script-Modul verwenden</fielddescription>
</field>
\endcode
\section1 Pre-defined Standard Variables
In addition to the field values entered by the user, you can use
the following pre-defined standard values:
\list
\li \c {%ProjectName%} is replaced by the name of the project in the
case of project wizards.
\li \c {%Path%} is replaced by the path to the target directory. For
classes, this is the directory, where the files are created. For
project wizards, an additional subdirectory named after the project
is created.
\li \c {%TargetPath%} is replaced by the path to the directory where the
actual files are created. For non-project wizards, it is identical
to \c %Path%. For project wizards, it is \c %Path%/%ProjectName%.
\li \c {%CppSourceSuffix%} is replaced by the default source suffix,
which is defined in \QC in \uicontrol {Tools > Options > C++ >
File Naming}. For example, if users enter \b MyClass, the
filename becomes myclass.cpp when the project is created.
\li \c {%CppHeaderSuffix%} is replaced by the default header suffix,
which is also defined in \uicontrol {File Naming}.
\li \c {%CurrentDate%} is replaced by the current date in the format
\c {YYYY-MM-DD} as specified by ISO 8601.
\li \c {%CurrentTime%} is replaced by the current time in the format
\c {HH:MM:SS} as specified by ISO 8601.
\li \c {%CurrentDate:Locale%} is replaced by the current date in the short format
specified by the application's locale.
\li \c {%CurrentTime:Locale%} is replaced by the current time in the short format
specified by the application's locale.
\li \c {%CurrentDate:ISO%} is replaced by the current date in the format
\c {YYYY-MM-DD} as specified by ISO 8601.
\li \c {%CurrentTime:ISO%} is replaced by the current time in the format
\c {HH:MM:SS} as specified by ISO 8601.
\li \c {%CurrentDate:RFC%} is replaced by the current date in the format
\c {DD Mon YYYY}, where \c {Mon} is the three letter month name, as specified by RFC 2822.
\li \c {%CurrentTime:RFC%} is replaced by the current time in the format
\c {HH:MM:SS} as specified by RFC 2822.
\endlist
\section1 Validating User Input
You can specify validation rules for user input. The rules consist of a
Boolean JavaScript expression and an error message. The placeholders in them
are replaced with values before they are evaluated or displayed.
Consider the following rule used in the \l{Creating Class Wizards} example:
\code
<validationrules>
<validationrule condition='"%ClassName%" != "QAbstractListModel"'>
<message>%ClassName% cannot be used as class name.</message>
<message xml:lang="de">%ClassName% kann nicht als Klassenname verwendet werden.</message>
</validationrule>
</validationrules>
\endcode
It ensures that the class name entered by the user does not match the name
of the base class. If the validation fails, a red label displaying the
message appears at the bottom of the wizard page.
\section1 Using Generator Scripts
The values entered in the wizard page are passed to the script
as command line arguments as defined by the wizard configuration file.
In addition, the script must implement a \c{--dry-run} command line option.
\QC needs to know the file names before the files are created to check
whether files with identical names already exist, for example. Therefore,
script file generation is a two-step process:
\list 1
\li Determine file names and attributes: The script is called with the
command line \c{--dry-run} option and the field values. It then prints
the relative path names of the files it intends to create, followed by
comma-separated attributes matching those of the \c{<file>} element, for
example:
\code
myclass.cpp,openeditor
myclass.h,openeditor
myproject.pro,openproject
\endcode
\li Create files: The script is called with the parameters only in the
working directory. It then actually creates the files. If directories
are needed, the script should create them, too.
\endlist
The \c{scriptgeneratedproject} sample wizard illustrates the usage.
A typical script invocation for this example (obtained by running \QC with
\c{--customwizard-verbose}) looks as follows:
\code
generate.pl --class-name=TestClass --project-name=TestProject --header-suffix=h --source-suffix=cpp --description=/tmp/qtcreatorj26629.txt
\endcode
By default, the scripts are run in the directory corresponding to
\c %TargetPath%. This can be overridden by specifying the attribute
\c workingdirectory on the element \c generatorscript. For example, if the
script creates the project directory by itself, %Path% can be specified. In
that case, \c --dry-run should output the correct relative paths or absolute
paths constructed using the value of \c %Path%.
*/

View File

@@ -143,6 +143,10 @@
\li \l{Opening Projects}
\li \l{Adding Libraries to Projects}
\li \l{Adding New Custom Wizards}
\list
\li \l{Adding JSON-Based Wizards}
\li \l{Adding XML-Based Wizards}
\endlist
\endlist
\li \l{Using Version Control Systems}
\li \l{Configuring Projects}

View File

@@ -102,7 +102,7 @@
\li Click \uicontrol Design to open the file in \QMLD.
\image qmldesigner-tutorial-desing-mode.png "Transitions project in Design Mode"
\image qmldesigner-tutorial-design-mode.png "Transitions project in Design Mode"
\li In the \uicontrol Navigator, select \uicontrol Text and press \key Delete to
delete it.

View File

@@ -49,7 +49,7 @@
\section1 Connecting Objects to Signals
To connect objects to signals in QML, create \l{Connection} objects.
To connect objects to signals in QML, create \l{Connections} objects.
\image qmldesigner-connections.png

View File

@@ -32,7 +32,7 @@
You can edit \l{Qt Quick UI Forms} (ui.qml files) in \QMLD. \QC opens the
UI forms in the \uicontrol Design mode. It is recommended that you use UI forms
for components that you want to desing in \QMLD.
for components that you want to design in \QMLD.
\image qmldesigner-visual-editor.png "Visual editor"
@@ -125,8 +125,8 @@
\section2 Setting the Stacking Order
The \l{Item#z-prop}{z property} of an
item determines its position in relation to its sibling items in the
The \c z property of an \l Item determines its position in relation to its
sibling items in the
type hierarchy. By default, items with a higher stacking value are
drawn on top of siblings with a lower stacking value. Items with the same
stacking value are drawn in the order they are listed, from the last item

View File

@@ -36,7 +36,8 @@
information for code completion and the semantic checks to work correctly.
When you write a QML module or use QML from a C++ application you typically
register new types with \l{QQmlEngine#qmlRegisterType-3}{qmlRegisterType()} or expose some
register new types with the \l{QQmlEngine} class \c qmlRegisterType()
function or expose some
class instances with \l{QQmlContext::setContextProperty()}. The \QC C++
code model now scans for these calls and
tells the QML code model about them. This means that properties are

View File

@@ -32,7 +32,7 @@
This tutorial describes how to use \QC to create a small Qt application,
Text Finder. It is a simplified version of the Qt UI Tools \l{Text Finder
example}. The application user interface is constructed from Qt widgets by
Example}. The application user interface is constructed from Qt widgets by
using \QD. The application logic is written in C++ by using the code editor.
\image qtcreator-textfinder-screenshot.png

View File

@@ -30,6 +30,9 @@
from dumper import *
def dumpLiteral(d, value):
d.putSimpleCharArray(value["_chars"], value["_size"])
def qdump__Core__Id(d, value):
try:
name = d.parseAndEvaluate("Core::nameForId(%d)" % value["m_id"])
@@ -74,7 +77,7 @@ def qdump__CPlusPlus__Identifier(d, value):
def qdump__CPlusPlus__Symbol(d, value):
name = d.downcast(value["_name"])
d.putItem(name)
dumpLiteral(d, name)
d.putBetterType(value.type)
d.putPlainChildren(value)
@@ -84,17 +87,17 @@ def qdump__CPlusPlus__IntegerType(d, value):
def qdump__CPlusPlus__NamedType(d, value):
literal = d.downcast(value["_name"])
d.putItem(literal)
dumpLiteral(d, literal)
d.putBetterType(value.type)
d.putPlainChildren(value)
def qdump__CPlusPlus__TemplateNameId(d, value):
d.putItem(value["_identifier"].dereference())
dumpLiteral(d, value["_identifier"].dereference())
d.putBetterType(value.type)
d.putPlainChildren(value)
def qdump__CPlusPlus__Literal(d, value):
d.putSimpleCharArray(value["_chars"], value["_size"])
dumpLiteral(d, value)
d.putPlainChildren(value)
def qdump__CPlusPlus__StringLiteral(d, value):
@@ -128,8 +131,8 @@ def qdump__CPlusPlus__Token(d, value):
def qdump__CPlusPlus__Internal__PPToken(d, value):
data, size, alloc = d.byteArrayData(value["m_src"])
length = int(value["f"]["length"])
offset = int(value["offset"])
length = int(value["f"]["utf16chars"])
offset = int(value["utf16charOffset"])
#warn("size: %s, alloc: %s, offset: %s, length: %s, data: %s"
# % (size, alloc, offset, length, data))
d.putValue(d.readMemory(data + offset, min(100, length)),

View File

@@ -74,9 +74,17 @@ Item {
block = true
colorButton.color = Qt.hsla(hue, saturation, lightness, alpha);
if (saturation > 0.0 && lightness > 0.0) {
hueSlider.value = hue
hueSlider2.value = hue
}
if (lightness > 0.0)
saturationSlider.value = saturation
else
saturation = saturationSlider.value
lightnessSlider.value = lightness
alphaSlider.value = alpha

View File

@@ -45,7 +45,6 @@ macx: DATA_DIRS += scripts
for(data_dir, DATA_DIRS) {
files = $$files($$PWD/$$data_dir/*, true)
win32:files ~= s|\\\\|/|g
# Info.plist.in are handled below
for(file, files):!contains(file, ".*/Info\\.plist\\.in$"):!exists($$file/*):FILES += $$file
}
@@ -78,7 +77,7 @@ for(data_dir, DATA_DIRS) {
QMAKE_SUBSTITUES += puppetinfo
puppet2info.input = qml/qmlpuppet/qml2puppet/Info.plist.in
puppet2info.output = $$IDE_DATA_PATH/qml/qmlpuppet/qml2puppet/Info.plist
QMAKE_SUBSTITUES += puppetinfo
QMAKE_SUBSTITUES += puppet2info
}
SRCRESOURCEDIR = $$IDE_SOURCE_TREE/src/share/qtcreator/

View File

@@ -4,5 +4,5 @@
qrcdeployment="qrcdeployment.pri"
stubversionminor="1">
<displayname>Qt Quick Controls 1.3</displayname>
<description>Creates a deployable Qt Quick 2 application that contains a .ui.qml file and uses Qt Quick Controls. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. This project requires that you have installed Qt Quick Controls for your Qt version. Requires Qt 5.4 or newer.</description>
<description>Creates a deployable Qt Quick 2 application that contains a .ui.qml file and uses Qt Quick Controls. This project requires that you have installed Qt Quick Controls for your Qt version. Requires Qt 5.4 or newer.</description>
</template>

File diff suppressed because it is too large Load Diff

View File

@@ -51,7 +51,6 @@ extract.commands += \
QMAKE_EXTRA_TARGETS += extract
plugin_sources = $$files($$IDE_SOURCE_TREE/src/plugins/*)
win32:plugin_sources ~= s,\\\\,/,g
plugin_sources ~= s,^$$re_escape($$IDE_SOURCE_TREE/),,g$$i_flag
plugin_sources -= src/plugins/plugins.pro \
src/plugins/helloworld \ # just an example

View File

@@ -534,9 +534,10 @@ bool TranslationUnit::maybeSplitGreaterGreaterToken(unsigned tokenIndex)
newGreater.byteOffset = tok.byteOffset + 1;
newGreater.utf16charOffset = tok.utf16charOffset + 1;
TokenLineColumn::const_iterator it = _expandedLineColumn.find(tok.bytesBegin());
_tokens->insert(_tokens->begin() + tokenIndex + 1, newGreater);
TokenLineColumn::const_iterator it = _expandedLineColumn.find(tok.bytesBegin());
if (it != _expandedLineColumn.end()) {
const std::pair<unsigned, unsigned> newPosition(it->second.first, it->second.second + 1);
_expandedLineColumn.insert(std::make_pair(newGreater.bytesBegin(), newPosition));

View File

@@ -1,5 +1,5 @@
isEmpty(LLVM_INSTALL_DIR):LLVM_INSTALL_DIR=$$(LLVM_INSTALL_DIR)
LLVM_INSTALL_DIR ~= s,\\\\,/,g
LLVM_INSTALL_DIR = $$clean_path($$LLVM_INSTALL_DIR)
DEFINES += CLANG_COMPLETION
DEFINES += CLANG_HIGHLIGHTING

View File

@@ -154,6 +154,12 @@ QList<Diagnostic> SemanticMarker::diagnostics() const
const unsigned size = qMin(ATTACHED_NOTES_LIMIT, numChildren);
for (unsigned di = 0; di < size; ++di) {
ScopedCXDiagnostic child(clang_getDiagnosticInSet(cxChildren, di));
const Diagnostic::Severity severity
= static_cast<Diagnostic::Severity>(clang_getDiagnosticSeverity(child));
if (severity == Diagnostic::Ignored || severity == Diagnostic::Note)
continue;
spelling.append(QLatin1String("\n "));
spelling.append(Internal::getQString(clang_getDiagnosticSpelling(child)));
}

View File

@@ -36,6 +36,7 @@
#include <QList>
#include <QPair>
#include <QPalette>
#include <QPushButton>
namespace ClearCase {
namespace Internal {
@@ -57,6 +58,8 @@ CheckOutDialog::CheckOutDialog(const QString &fileName, bool isUcm, QWidget *par
ui->verticalLayout->insertWidget(1, line);
}
ui->buttonBox->button(QDialogButtonBox::Ok)->setFocus();
}
CheckOutDialog::~CheckOutDialog()

View File

@@ -47,6 +47,7 @@
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/documentmanager.h>
#include <coreplugin/editormanager/documentmodel.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/infobar.h>
@@ -1648,6 +1649,14 @@ bool ClearCasePlugin::vcsOpen(const QString &workingDir, const QString &fileName
&& !m_settings.disableIndexer) {
setStatus(absPath, FileStatus::CheckedOut);
}
foreach (DocumentModel::Entry *e, DocumentModel::entries()) {
if (e->fileName() == absPath) {
e->document->checkPermissions();
break;
}
}
return !response.error;
}
return true;

View File

@@ -276,7 +276,7 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeSettingsPage *settingsPage)
setEditorCreator([]() { return new CMakeEditor; });
setEditorWidgetCreator([]() { return new CMakeEditorWidget; });
setDocumentCreator([]() { return new CMakeDocument; });
setGenericSyntaxHighlighter(QLatin1String(Constants::CMAKEMIMETYPE));
setGenericSyntaxHighlighterByName(QLatin1String("CMake"));
setCommentStyle(Utils::CommentDefinition::HashStyle);
setCodeFoldingSupported(true);

View File

@@ -189,6 +189,7 @@ void DesignMode::unregisterDesignWidget(QWidget *widget)
foreach (DesignEditorInfo *info, d->m_editors) {
if (info->widget == widget) {
d->m_editors.removeAll(info);
delete info;
break;
}
}

View File

@@ -619,6 +619,9 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
switch (element) {
case CE_Splitter:
if (creatorTheme()->widgetStyle() == Theme::StyleFlat)
painter->fillRect(option->rect, creatorTheme()->color(Theme::BackgroundColorSelected));
else
painter->fillRect(option->rect, Utils::StyleHelper::borderColor());
break;

View File

@@ -38,17 +38,9 @@
using namespace Core::Tests;
static void maybeAppendSlash(QString *string)
{
const QChar slash = QLatin1Char('/');
if (!string->endsWith(slash))
string->append(slash);
}
TestDataDir::TestDataDir(const QString &directory)
: m_directory(directory)
{
maybeAppendSlash(&m_directory);
QFileInfo fi(m_directory);
QVERIFY(fi.exists());
QVERIFY(fi.isDir());
@@ -56,7 +48,7 @@ TestDataDir::TestDataDir(const QString &directory)
QString TestDataDir::file(const QString &fileName) const
{
return directory() + fileName;
return directory() + QLatin1Char('/') + fileName;
}
QString TestDataDir::path() const
@@ -71,6 +63,5 @@ QString TestDataDir::directory(const QString &subdir, bool clean) const
path += QLatin1Char('/') + subdir;
if (clean)
path = QDir::cleanPath(path);
maybeAppendSlash(&path);
return path;
}

View File

@@ -119,8 +119,8 @@ bool isCppStyleContinuation(const QTextCursor& cursor)
return isPreviousLineCppStyleComment(cursor) || isNextLineCppStyleComment(cursor);
}
/// Check if line is a CppStyle Doxygen comment and the cursor is after the comment
bool isCursorAfterCppComment(const QTextCursor &cursor, const QTextDocument *doc)
bool lineStartsWithCppDoxygenCommentAndCursorIsAfter(const QTextCursor &cursor,
const QTextDocument *doc)
{
QTextCursor cursorFirstNonBlank(cursor);
cursorFirstNonBlank.movePosition(QTextCursor::StartOfLine);
@@ -136,6 +136,27 @@ bool isCursorAfterCppComment(const QTextCursor &cursor, const QTextDocument *doc
return false;
}
bool isCursorAfterNonNestedCppStyleComment(const QTextCursor &cursor,
TextEditor::TextEditorWidget *editorWidget)
{
QTextDocument *document = editorWidget->document();
QTextCursor cursorBeforeCppComment(cursor);
while (document->characterAt(cursorBeforeCppComment.position()) != QLatin1Char('/')
&& cursorBeforeCppComment.movePosition(QTextCursor::PreviousCharacter)) {
}
if (!cursorBeforeCppComment.movePosition(QTextCursor::PreviousCharacter))
return false;
if (document->characterAt(cursorBeforeCppComment.position()) != QLatin1Char('/'))
return false;
if (!cursorBeforeCppComment.movePosition(QTextCursor::PreviousCharacter))
return false;
return !editorWidget->autoCompleter()->isInComment(cursorBeforeCppComment);
}
bool handleDoxygenCppStyleContinuation(QTextCursor &cursor)
{
const int blockPos = cursor.positionInBlock();
@@ -166,17 +187,24 @@ bool handleDoxygenCppStyleContinuation(QTextCursor &cursor)
}
bool handleDoxygenContinuation(QTextCursor &cursor,
const QTextDocument *doc,
TextEditor::TextEditorWidget *editorWidget,
const bool enableDoxygen,
const bool leadingAsterisks)
{
const QTextDocument *doc = editorWidget->document();
// It might be a continuation if:
// a) current line starts with /// or //! and cursor is positioned after the comment
// b) current line is in the middle of a multi-line Qt or Java style comment
if (enableDoxygen && !cursor.atEnd() && isCursorAfterCppComment(cursor, doc))
if (!cursor.atEnd()) {
if (enableDoxygen && lineStartsWithCppDoxygenCommentAndCursorIsAfter(cursor, doc))
return handleDoxygenCppStyleContinuation(cursor);
if (isCursorAfterNonNestedCppStyleComment(cursor, editorWidget))
return false;
}
// We continue the comment if the cursor is after a comment's line asterisk and if
// there's no asterisk immediately after the cursor (that would already be considered
// a leading asterisk).
@@ -219,6 +247,14 @@ bool handleDoxygenContinuation(QTextCursor &cursor,
else
newLine.append(QLatin1String(" "));
} else {
// If '*' is not within a comment, skip.
QTextCursor cursorOnFirstNonWhiteSpace(cursor);
const int positionOnFirstNonWhiteSpace = cursor.position() - blockPos + offset;
cursorOnFirstNonWhiteSpace.setPosition(positionOnFirstNonWhiteSpace);
if (!editorWidget->autoCompleter()->isInComment(cursorOnFirstNonWhiteSpace))
return false;
// ...otherwise do the continuation
int start = offset;
while (offset < blockPos && currentLine.at(offset) == QLatin1Char('*'))
++offset;
@@ -292,12 +328,11 @@ bool trySplitComment(TextEditor::TextEditorWidget *editorWidget)
return true;
}
}
}
} // right after first doxygen comment
return handleDoxygenContinuation(cursor,
editorWidget->document(),
editorWidget,
settings.m_enableDoxygen,
settings.m_leadingAsterisks);
}

View File

@@ -261,6 +261,24 @@ void CppEditorPlugin::test_doxygen_comments_data()
"void d(); ///\n"
"\n"
);
QTest::newRow("noContinuationForExpressionAndComment1") << _(
"bool preventFolding;\n"
"*foo //|\n"
) << _(
"bool preventFolding;\n"
"*foo //\n"
"\n"
);
QTest::newRow("noContinuationForExpressionAndComment2") << _(
"bool preventFolding;\n"
"*foo /*|\n"
) << _(
"bool preventFolding;\n"
"*foo /*\n"
" \n"
);
}
void CppEditorPlugin::test_doxygen_comments()

View File

@@ -493,7 +493,8 @@ void CppEditorWidget::contextMenuEvent(QContextMenuEvent *e)
QSignalMapper mapper;
connect(&mapper, SIGNAL(mapped(int)), this, SLOT(performQuickFix(int)));
if (isSemanticInfoValid()) {
if (isSemanticInfoValidExceptLocalUses()) {
d->m_useSelectionsUpdater.update(CppUseSelectionsUpdater::Synchronous);
AssistInterface *interface = createAssistInterface(QuickFix, ExplicitlyInvoked);
if (interface) {
QScopedPointer<IAssistProcessor> processor(

View File

@@ -1497,6 +1497,57 @@ void CppEditorPlugin::test_quickfix_data()
" f1(*str);\n"
"}\n");
QTest::newRow("ConvertAutoFromPointer")
<< CppQuickFixFactoryPtr(new ConvertFromAndToPointer)
<< _("void foo() {\n"
" auto @str = new QString(QLatin1String(\"foo\"));\n"
" if (!str->isEmpty())\n"
" str->clear();\n"
" f1(*str);\n"
" f2(str);\n"
"}\n")
<< _("void foo() {\n"
" auto str = QString(QLatin1String(\"foo\"));\n"
" if (!str.isEmpty())\n"
" str.clear();\n"
" f1(str);\n"
" f2(&str);\n"
"}\n");
QTest::newRow("ConvertAutoFromPointer2")
<< CppQuickFixFactoryPtr(new ConvertFromAndToPointer)
<< _("void foo() {\n"
" auto *@str = new QString;\n"
" if (!str->isEmpty())\n"
" str->clear();\n"
" f1(*str);\n"
" f2(str);\n"
"}\n")
<< _("void foo() {\n"
" auto str = QString();\n"
" if (!str.isEmpty())\n"
" str.clear();\n"
" f1(str);\n"
" f2(&str);\n"
"}\n");
QTest::newRow("ConvertAutoToPointer")
<< CppQuickFixFactoryPtr(new ConvertFromAndToPointer)
<< _("void foo() {\n"
" auto @str = QString(QLatin1String(\"foo\"));\n"
" if (!str.isEmpty())\n"
" str.clear();\n"
" f1(str);\n"
" f2(&str);\n"
"}\n")
<< _("void foo() {\n"
" auto @str = new QString(QLatin1String(\"foo\"));\n"
" if (!str->isEmpty())\n"
" str->clear();\n"
" f1(*str);\n"
" f2(str);\n"
"}\n");
QTest::newRow("InsertQtPropertyMembers_noTriggerInvalidCode")
<< CppQuickFixFactoryPtr(new InsertQtPropertyMembers)
<< _("class C { @Q_PROPERTY(typeid foo READ foo) };\n")

View File

@@ -3862,12 +3862,14 @@ public:
enum Mode { FromPointer, FromVariable, FromReference };
ConvertFromAndToPointerOp(const CppQuickFixInterface &interface, int priority, Mode mode,
bool isAutoDeclaration,
const SimpleDeclarationAST *simpleDeclaration,
const DeclaratorAST *declaratorAST,
const SimpleNameAST *identifierAST,
Symbol *symbol)
: CppQuickFixOperation(interface, priority)
, m_mode(mode)
, m_isAutoDeclaration(isAutoDeclaration)
, m_simpleDeclaration(simpleDeclaration)
, m_declaratorAST(declaratorAST)
, m_identifierAST(identifierAST)
@@ -3906,6 +3908,8 @@ public:
private:
void removePointerOperator(ChangeSet &changes) const
{
if (!m_declaratorAST->ptr_operator_list)
return;
PointerAST *ptrAST = m_declaratorAST->ptr_operator_list->value->asPointer();
QTC_ASSERT(ptrAST, return);
const int pos = m_file->startOf(ptrAST->star_token);
@@ -3942,23 +3946,42 @@ private:
}
}
void removeNewKeyword(ChangeSet &changes, NewExpressionAST *newExprAST) const
{
// remove 'new' keyword before initializer
changes.remove(m_file->startOf(newExprAST->new_token),
m_file->startOf(newExprAST->new_type_id));
}
void convertToStackVariable(ChangeSet &changes) const
{
// Handle the initializer.
if (m_declaratorAST->initializer) {
if (NewExpressionAST *newExpression = m_declaratorAST->initializer->asNewExpression())
if (NewExpressionAST *newExpression = m_declaratorAST->initializer->asNewExpression()) {
if (m_isAutoDeclaration) {
if (!newExpression->new_initializer)
changes.insert(m_file->endOf(newExpression), QStringLiteral("()"));
removeNewKeyword(changes, newExpression);
} else {
removeNewExpression(changes, newExpression);
}
}
}
// Fix all occurrences of the identifier in this function.
ASTPath astPath(m_document);
foreach (const SemanticInfo::Use &use, semanticInfo().localUses.value(m_symbol)) {
const QList<AST *> path = astPath(use.line, use.column);
AST *idAST = path.last();
bool declarationFound = false;
bool starFound = false;
int ampersandPos = 0;
bool memberAccess = false;
for (int i = path.count() - 2; i >= 0; --i) {
if (path.at(i) == m_declaratorAST) {
declarationFound = true;
break;
}
if (MemberAccessAST *memberAccessAST = path.at(i)->asMemberAccess()) {
if (m_file->tokenAt(memberAccessAST->access_token).kind() != T_ARROW)
continue;
@@ -3987,7 +4010,7 @@ private:
break;
}
}
if (!starFound && !memberAccess) {
if (!declarationFound && !starFound && !memberAccess) {
if (ampersandPos) {
changes.insert(ampersandPos, QLatin1String("&("));
changes.insert(m_file->endOf(idAST->firstToken()), QLatin1String(")"));
@@ -4017,12 +4040,14 @@ private:
void insertNewExpression(ChangeSet &changes, CallAST *callAST) const
{
const QString typeName = typeNameOfDeclaration();
if (typeName.isEmpty())
return;
if (typeName.isEmpty()) {
changes.insert(m_file->startOf(callAST), QLatin1String("new "));
} else {
changes.insert(m_file->startOf(callAST),
QLatin1String("new ") + typeName + QLatin1Char('('));
changes.insert(m_file->startOf(callAST->lastToken()), QLatin1String(")"));
}
}
void insertNewExpression(ChangeSet &changes, ExpressionListParenAST *exprListAST) const
{
@@ -4054,6 +4079,10 @@ private:
AST *idAST = path.last();
bool insertStar = true;
for (int i = path.count() - 2; i >= 0; --i) {
if (m_isAutoDeclaration && path.at(i) == m_declaratorAST) {
insertStar = false;
break;
}
if (MemberAccessAST *memberAccessAST = path.at(i)->asMemberAccess()) {
const int pos = m_file->startOf(memberAccessAST->access_token);
changes.replace(pos, pos + 1, QLatin1String("->"));
@@ -4076,6 +4105,7 @@ private:
}
const Mode m_mode;
const bool m_isAutoDeclaration;
const SimpleDeclarationAST * const m_simpleDeclaration;
const DeclaratorAST * const m_declaratorAST;
const SimpleNameAST * const m_identifierAST;
@@ -4129,7 +4159,23 @@ void ConvertFromAndToPointer::match(const CppQuickFixInterface &interface,
if (!symbol)
return;
if (declarator->ptr_operator_list) {
bool isAutoDeclaration = false;
if (symbol->storage() == Symbol::Auto) {
// For auto variables we must deduce the type from the initializer.
if (!declarator->initializer)
return;
isAutoDeclaration = true;
TypeOfExpression typeOfExpression;
typeOfExpression.init(interface.semanticInfo().doc, interface.snapshot());
typeOfExpression.setExpandTemplates(true);
CppRefactoringFilePtr file = interface.currentFile();
Scope *scope = file->scopeAt(declarator->firstToken());
QList<LookupItem> result = typeOfExpression(file->textOf(declarator->initializer).toUtf8(),
scope, TypeOfExpression::Preprocess);
if (!result.isEmpty() && result.first().type()->isPointerType())
mode = ConvertFromAndToPointerOp::FromPointer;
} else if (declarator->ptr_operator_list) {
for (PtrOperatorListAST *ops = declarator->ptr_operator_list; ops; ops = ops->next) {
if (ops != declarator->ptr_operator_list) {
// Bail out on more complex pointer types (e.g. pointer of pointer,
@@ -4144,8 +4190,8 @@ void ConvertFromAndToPointer::match(const CppQuickFixInterface &interface,
}
const int priority = path.size() - 1;
result.append(new ConvertFromAndToPointerOp(interface, priority, mode, simpleDeclaration,
declarator, identifier, symbol));
result.append(new ConvertFromAndToPointerOp(interface, priority, mode, isAutoDeclaration,
simpleDeclaration, declarator, identifier, symbol));
}
namespace {

View File

@@ -394,8 +394,7 @@ ProjectPart::HeaderPaths CppModelManager::internalHeaderPaths() const
const ProjectInfo pinfo = it.value();
foreach (const ProjectPart::Ptr &part, pinfo.projectParts()) {
foreach (const ProjectPart::HeaderPath &path, part->headerPaths) {
const ProjectPart::HeaderPath hp(CppSourceProcessor::cleanPath(path.path),
path.type);
const ProjectPart::HeaderPath hp(QDir::cleanPath(path.path), path.type);
if (!headerPaths.contains(hp))
headerPaths += hp;
}

View File

@@ -75,7 +75,7 @@ public:
{ return directory(_("frameworks"), cleaned); }
QString fileFromSourcesDir(const QString &fileName) const
{ return directory(_("sources")) + fileName; }
{ return directory(_("sources")) + QLatin1Char('/') + fileName; }
};
QStringList toAbsolutePaths(const QStringList &relativePathList,

View File

@@ -37,6 +37,8 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
#include <utils/qtcassert.h>
#include <QSet>
#include <QTextStream>
@@ -448,12 +450,16 @@ void ProjectPartBuilder::createProjectPart(const QStringList &theSources,
CppTools::ProjectPart::Ptr part(m_templatePart->copy());
part->displayName = partName;
Kit *k = part->project->activeTarget()->kit();
if (ToolChain *tc = ToolChainKitInformation::toolChain(k))
part->evaluateToolchain(tc,
languageVersion >= ProjectPart::CXX98 ? m_cxxFlags
: m_cFlags,
SysRootKitInformation::sysRoot(k));
QTC_ASSERT(part->project, return);
if (ProjectExplorer::Target *activeTarget = part->project->activeTarget()) {
if (Kit *kit = activeTarget->kit()) {
if (ToolChain *toolChain = ToolChainKitInformation::toolChain(kit)) {
const QStringList flags = languageVersion >= ProjectPart::CXX98 ? m_cxxFlags
: m_cFlags;
part->evaluateToolchain(toolChain, flags, SysRootKitInformation::sysRoot(kit));
}
}
}
part->languageExtensions |= languageExtensions;

View File

@@ -270,6 +270,7 @@ void GitDiffHandler::addJob(VcsCommand *command,
args << QLatin1String("--ignore-space-change");
args << QLatin1String("--unified=") + QString::number(
m_controller->contextLinesNumber());
args << QLatin1String("--src-prefix=a/") << QLatin1String("--dst-prefix=b/");
args << arguments;
command->addJob(args, timeout());
}

View File

@@ -658,7 +658,7 @@ void HelpPlugin::slotOpenSupportPage()
void HelpPlugin::slotReportBug()
{
QDesktopServices::openUrl(QUrl(QLatin1String("https://bugreports.qt-project.org")));
QDesktopServices::openUrl(QUrl(QLatin1String("https://bugreports.qt.io")));
}
void HelpPlugin::doSetupIfNeeded()

View File

@@ -746,6 +746,16 @@ Abi Abi::hostAbi()
os = MacOS;
subos = GenericMacFlavor;
format = MachOFormat;
#elif defined (Q_OS_BSD4)
os = BsdOS;
# if defined (Q_OS_FREEBSD)
subos = FreeBsdFlavor;
# elif defined (Q_OS_NETBSD)
subos = NetBsdFlavor;
# elif defined (Q_OS_OPENBSD)
subos = OpenBsdFlavor;
# endif
format = ElfFormat;
#endif
const Abi result(arch, os, subos, format, QSysInfo::WordSize);

View File

@@ -391,16 +391,14 @@ QList<Utils::FileName> MsvcToolChain::suggestedMkspecList() const
case Abi::WindowsMsvc2010Flavor:
return QList<Utils::FileName>() << Utils::FileName::fromLatin1("win32-msvc2010");
case Abi::WindowsMsvc2012Flavor:
QList<Utils::FileName>()
return QList<Utils::FileName>()
<< Utils::FileName::fromLatin1("win32-msvc2012")
<< Utils::FileName::fromLatin1("win32-msvc2010");
break;
case Abi::WindowsMsvc2013Flavor:
QList<Utils::FileName>()
return QList<Utils::FileName>()
<< Utils::FileName::fromLatin1("win32-msvc2013")
<< Utils::FileName::fromLatin1("win32-msvc2012")
<< Utils::FileName::fromLatin1("win32-msvc2010");
break;
default:
break;
}

View File

@@ -84,6 +84,11 @@ CrumbleBar::CrumbleBar(QObject *parent) :
updateVisibility();
}
CrumbleBar::~CrumbleBar()
{
delete m_crumblePath;
}
void CrumbleBar::pushFile(const QString &fileName)
{
if (m_isInternalCalled == false) {

View File

@@ -42,6 +42,7 @@ class CrumbleBar : public QObject
Q_OBJECT
public:
explicit CrumbleBar(QObject *parent = 0);
~CrumbleBar();
void pushFile(const QString &fileName);
void pushInFileComponent(const ModelNode &modelNode);

View File

@@ -71,6 +71,7 @@ QnxConfigurationManager::~QnxConfigurationManager()
{
m_instance = 0;
qDeleteAll(m_configurations);
delete m_writer;
}
QList<QnxConfiguration *> QnxConfigurationManager::configurations() const

View File

@@ -28,8 +28,8 @@
**
****************************************************************************/
#ifndef BASETEXTDOCUMENTLAYOUT_H
#define BASETEXTDOCUMENTLAYOUT_H
#ifndef TEXTDOCUMENTLAYOUT_H
#define TEXTDOCUMENTLAYOUT_H
#include "texteditor_global.h"
@@ -229,4 +229,4 @@ signals:
} // namespace TextEditor
#endif // BASETEXTDOCUMENTLAYOUT_H
#endif // TEXTDOCUMENTLAYOUT_H

View File

@@ -7373,6 +7373,20 @@ void TextEditorFactory::setGenericSyntaxHighlighter(const QString &mimeType)
};
}
void TextEditorFactory::setGenericSyntaxHighlighterByName(const QString &name)
{
d->m_syntaxHighlighterCreator = [this, name]() -> SyntaxHighlighter * {
TextEditor::Highlighter *highlighter = new TextEditor::Highlighter();
QString definitionId = Manager::instance()->definitionIdByName(name);
if (!definitionId.isEmpty()) {
const QSharedPointer<HighlightDefinition> &definition = Manager::instance()->definition(definitionId);
if (!definition.isNull() && definition->isValid())
highlighter->setDefaultContext(definition->initialContext());
}
return highlighter;
};
}
void TextEditorFactory::setAutoCompleterCreator(const AutoCompleterCreator &creator)
{
d->m_autoCompleterCreator = creator;

View File

@@ -665,6 +665,7 @@ public:
void setIndenterCreator(const IndenterCreator &creator);
void setSyntaxHighlighterCreator(const SyntaxHighLighterCreator &creator);
void setGenericSyntaxHighlighter(const QString &mimeType);
void setGenericSyntaxHighlighterByName(const QString &name);
void setAutoCompleterCreator(const AutoCompleterCreator &creator);
void setEditorActionHandlers(Core::Id contextId, uint optionalActions);

View File

@@ -186,7 +186,7 @@ QModelIndex DataModel::indexForObject(const Function *function) const
}
/**
* Evil workaround for https://bugreports.qt-project.org/browse/QTBUG-1135
* Evil workaround for https://bugreports.qt.io/browse/QTBUG-1135
* Just replace the bad hyphens by a 'NON-BREAKING HYPHEN' unicode char
*/
static QString noWrap(const QString &str)

View File

@@ -794,7 +794,7 @@ QWidget *CallgrindToolPrivate::createWidgets()
m_filterProjectCosts = action;
// filter
///FIXME: find workaround for https://bugreports.qt-project.org/browse/QTCREATORBUG-3247
///FIXME: find workaround for https://bugreports.qt.io/browse/QTCREATORBUG-3247
QLineEdit *filter = new QLineEdit;
filter->setPlaceholderText(tr("Filter..."));
connect(filter, SIGNAL(textChanged(QString)), m_updateTimer, SLOT(start()));

View File

@@ -54,7 +54,7 @@
// Margin from hardcoded value in:
// QGraphicsView::fitInView(const QRectF &rect,
// Qt::AspectRatioMode aspectRatioMode)
// Bug report here: https://bugreports.qt-project.org/browse/QTBUG-11945
// Bug report here: https://bugreports.qt.io/browse/QTBUG-11945
static const int FIT_IN_VIEW_MARGIN = 2;
using namespace Valgrind::Callgrind;

View File

@@ -37,7 +37,7 @@ QT_BEGIN_NAMESPACE
class QPalette;
QT_END_NAMESPACE
///FIXME: remove this once https://bugreports.qt-project.org/browse/QTCREATORBUG-3247 gets fixed
///FIXME: remove this once https://bugreports.qt.io/browse/QTCREATORBUG-3247 gets fixed
QPalette panelPalette(const QPalette &oldPalette, bool lightColored = false);
#endif // WORKAROUNDS_H

View File

@@ -608,8 +608,8 @@ static void ChildSignal(int /*arg*/) {
NSArray* devices = [deviceSet availableDevices];
NSArray* deviceTypeAndVersion = [devTypeId componentsSeparatedByString:@","];
if(deviceTypeAndVersion.count == 2) {
NSString* typeIdentifier = [deviceTypeAndVersion.firstObject stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
NSString* versionString = [deviceTypeAndVersion.lastObject stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];;
NSString* typeIdentifier = [[deviceTypeAndVersion objectAtIndex:0] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
NSString* versionString = [[deviceTypeAndVersion objectAtIndex:1] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];;
for (SimDevice* device in devices) {
if ([device.deviceType.identifier isEqualToString:typeIdentifier] && [device.runtime.versionString isEqualToString:versionString]) {
return device;

View File

@@ -13,7 +13,7 @@ include(../../rpath.pri)
win32|equals(TEST, 1):DEFINES += HAS_MSVC_PARSER
DESTDIR = $$IDE_BIN_PATH
target.path = /bin
target.path = $$QTC_PREFIX/bin
INSTALLS += target
SOURCES = \

View File

@@ -35,7 +35,7 @@
#include <QString>
const char APPLICATION_NAME[] = "Qt Creator Crash Handler";
const char URL_BUGTRACKER[] = "https://bugreports.qt-project.org/";
const char URL_BUGTRACKER[] = "https://bugreports.qt.io/";
QByteArray fileContents(const QString &filePath);

View File

@@ -5299,7 +5299,7 @@ void tst_Dumpers::dumper_data()
+ Check("vector.1", "[1]", "2", "double");
#endif
// https://bugreports.qt-project.org/browse/QTCREATORBUG-3611
// https://bugreports.qt.io/browse/QTCREATORBUG-3611
QTest::newRow("Bug3611")
<< Data("typedef unsigned char byte;\n"
"byte f = '2';\n"
@@ -5308,7 +5308,7 @@ void tst_Dumpers::dumper_data()
+ Check("f", "50", "byte") % GdbEngine;
// https://bugreports.qt-project.org/browse/QTCREATORBUG-4904
// https://bugreports.qt.io/browse/QTCREATORBUG-4904
QTest::newRow("Bug4904")
<< Data("#include <QMap>\n"
"struct CustomStruct {\n"
@@ -5334,7 +5334,7 @@ void tst_Dumpers::dumper_data()
#if 0
// https://bugreports.qt-project.org/browse/QTCREATORBUG-5106
// https://bugreports.qt.io/browse/QTCREATORBUG-5106
QTest::newRow("Bug5106")
<< Data("struct A5106 {\n"
" A5106(int a, int b) : m_a(a), m_b(b) {}\n"
@@ -5356,7 +5356,7 @@ void tst_Dumpers::dumper_data()
#endif
// https://bugreports.qt-project.org/browse/QTCREATORBUG-5184
// https://bugreports.qt.io/browse/QTCREATORBUG-5184
// Note: The report there shows type field "QUrl &" instead of QUrl");
// It's unclear how this can happen. It should never have been like
@@ -5382,7 +5382,7 @@ void tst_Dumpers::dumper_data()
+ Check5("url", "\"http://127.0.0.1/\"", "@QUrl &");
// https://bugreports.qt-project.org/browse/QTCREATORBUG-5799
// https://bugreports.qt.io/browse/QTCREATORBUG-5799
QTest::newRow("Bug5799")
<< Data("typedef struct { int m1; int m2; } S1;\n"
"struct S2 : S1 { };\n"
@@ -5408,7 +5408,7 @@ void tst_Dumpers::dumper_data()
+ CheckType("s4.@1.m2", "int");
// https://bugreports.qt-project.org/browse/QTCREATORBUG-6465
// https://bugreports.qt.io/browse/QTCREATORBUG-6465
QTest::newRow("Bug6465")
<< Data("typedef char Foo[20];\n"
"Foo foo = \"foo\";\n"
@@ -5417,7 +5417,7 @@ void tst_Dumpers::dumper_data()
#ifndef Q_OS_WIN
// https://bugreports.qt-project.org/browse/QTCREATORBUG-6857
// https://bugreports.qt.io/browse/QTCREATORBUG-6857
QTest::newRow("Bug6857")
<< Data("#include <QFile>\n"
"#include <QString>\n"

View File

@@ -5103,7 +5103,7 @@ namespace basic {
dummyStatement(&foo);
}
// https://bugreports.qt-project.org/browse/QTCREATORBUG-5326
// https://bugreports.qt.io/browse/QTCREATORBUG-5326
void testChar()
{
@@ -6360,7 +6360,7 @@ namespace bug842 {
void test842()
{
// https://bugreports.qt-project.org/browse/QTCREATORBUG-842
// https://bugreports.qt.io/browse/QTCREATORBUG-842
qWarning("Test");
BREAK_HERE;
// Continue.
@@ -6375,7 +6375,7 @@ namespace bug3611 {
void test3611()
{
// https://bugreports.qt-project.org/browse/QTCREATORBUG-3611
// https://bugreports.qt.io/browse/QTCREATORBUG-3611
typedef unsigned char byte;
byte f = '2';
int *x = (int*)&f;
@@ -6397,7 +6397,7 @@ namespace bug3611 {
namespace bug4019 {
// https://bugreports.qt-project.org/browse/QTCREATORBUG-4019
// https://bugreports.qt.io/browse/QTCREATORBUG-4019
class A4019
{
@@ -6423,7 +6423,7 @@ namespace bug4019 {
namespace bug4997 {
// https://bugreports.qt-project.org/browse/QTCREATORBUG-4997
// https://bugreports.qt.io/browse/QTCREATORBUG-4997
void test4997()
{
@@ -6437,7 +6437,7 @@ namespace bug4997 {
namespace bug4904 {
// https://bugreports.qt-project.org/browse/QTCREATORBUG-4904
// https://bugreports.qt.io/browse/QTCREATORBUG-4904
struct CustomStruct {
int id;
@@ -6472,7 +6472,7 @@ namespace bug4904 {
namespace bug5046 {
// https://bugreports.qt-project.org/browse/QTCREATORBUG-5046
// https://bugreports.qt.io/browse/QTCREATORBUG-5046
struct Foo { int a, b, c; };
@@ -6501,7 +6501,7 @@ namespace bug5046 {
namespace bug5106 {
// https://bugreports.qt-project.org/browse/QTCREATORBUG-5106
// https://bugreports.qt.io/browse/QTCREATORBUG-5106
class A5106
{
@@ -6533,7 +6533,7 @@ namespace bug5106 {
namespace bug5184 {
// https://bugreports.qt-project.org/browse/QTCREATORBUG-5184
// https://bugreports.qt.io/browse/QTCREATORBUG-5184
// Note: The report there shows type field "QUrl &" instead of QUrl.
// It's unclear how this can happen. It should never have been like
@@ -6606,7 +6606,7 @@ namespace qc42170 {
namespace bug5799 {
// https://bugreports.qt-project.org/browse/QTCREATORBUG-5799
// https://bugreports.qt.io/browse/QTCREATORBUG-5799
typedef struct { int m1; int m2; } S1;
@@ -6646,7 +6646,7 @@ namespace bug5799 {
namespace bug6813 {
// https://bugreports.qt-project.org/browse/QTCREATORBUG-6813
// https://bugreports.qt.io/browse/QTCREATORBUG-6813
void test6813()
{
int foo = 0;
@@ -6724,7 +6724,7 @@ namespace cp42895 {
namespace bug6465 {
// https://bugreports.qt-project.org/browse/QTCREATORBUG-6465
// https://bugreports.qt.io/browse/QTCREATORBUG-6465
void test6465()
{

View File

@@ -60,7 +60,7 @@ def macHackActivateContextMenuItem(item, widget=None):
################ workarounds for issues tracked inside jira #################
JIRA_URL='https://bugreports.qt-project.org/browse'
JIRA_URL='https://bugreports.qt.io/browse'
class JIRA:
__instance__ = None