Commit 6b6d9871 authored by dt's avatar dt

Merge remote branch 'origin/2.1'

parents a84ad427 c7142aff
......@@ -14,13 +14,16 @@ General
C++ Support
* Added semantic highlighting of types, virtual methods, locals, statics and
member variables (only enabled when running against Qt 4.7.1 and up, for
performance reasons)
* Add new %FILENAME%, %CLASS% placeholders to license template
Project Support
* Add option for adding subprojects to projects in the New wizard
* Add context-menu command for removing subprojects in the Edit mode,
Projects view
* Add a wizard for adding other than Qt libraries to project files
* Add a wizard for adding other than Qt libraries to project files
* Fix console debugging with MinGW/gdb

92.8 KB | W: | H:


119 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

46.3 KB | W: | H:


17.6 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

7.04 KB | W: | H:


22 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
......@@ -1818,21 +1818,7 @@
You use wizards to create and import several types of projects and files, such
as Qt GUI or console applications and Qt Quick applications.
You can also use
wizards to add individual files to your projects. For example, you can create
the following types of files:
\o Qt resource files, which allow you to store binary files in the
application executable
\o \QD forms and Qt QML files, which specify parts of application user
\o C++ class, source, or header files
You can use wizards also to add individual files to your projects.
The wizards prompt you to enter the settings needed
for that particular type of project and create the necessary files for you.
......@@ -1863,6 +1849,14 @@
\image qtcreator-intro-and-location.png
\o Select the Qt versions to use as build targets for your project, and click
\image qtcreator-new-project-qt-versions.png "Target setting dialog"
\note If you have only one Qt version installed, this dialog is skipped.
\o Specify the name of the class you want to create and using the
drop-down menu select its base class type.
......@@ -1878,10 +1872,43 @@
\image qtcreator-new-project-summary.png
\section1 Adding Files to Projects
You can create the following types of files:
\o Qt resource files, which allow you to store binary files in the
application executable
\o \QD forms and Qt QML files, which specify parts of application user
\o C++ class, source, or header files
\o Text files
\section2 Creating C++ Classes
The \gui {C++ Class Wizard} allows you to create a C++ header and source file for
a new class that you can add to a C++ project. Specify the class name, base
class, and header and source files for the class.
The wizard supports namespaces. To use a namespace, enter a qualified
class name in the \gui {Class name} field. For example:
\image qtcreator-cpp-class-wizard.png "Enter Class Name dialog"
The names of the header and source file are based on the class name. To change the
default suffix of a file, click \gui Configure.
You can create your own project and class wizards. For more information,
see \l{Adding New Custom Wizards}.
\section1 Displaying Additional File Types in Projects Pane
\section2 Displaying Additional File Types in Projects Pane
Qt Creator determines whether to display files from the project folder
in the \gui Projects pane depending on the file type (.pro, .pri, .cpp,
......@@ -1900,6 +1927,35 @@
This also makes the files available in the \gui Locator.
\section1 Adding Subprojects to Projects
When you create a new project, you can add it to another project as a subproject
in the \gui{Project Management} dialog. However, you first have to edit the
.pro file of the parent project to specify that qmake uses the \c subdirs template
to build the project.
The \c subdirs template creates a Makefile for building subprojects. They can be
located either in subdirectories of the project directory or in any other directory.
The location of the targets is specified using the SUBDIRS variable. If the project file
has the same name as the directory, you can just specify the directory name. If the project
name and directory name are different, you must specify the project file name (.pro).
For more information on the SUBDIRS variable, see the
\l{}{qmake Variable Reference}.
For example, the following code specifies that plugin_coreplugin/
and belong to the project:
TEMPLATE = subdirs
SUBDIRS = plugin_coreplugin \
To specify dependencies, use the \gui{Add Library} wizard. For more information,
see \l{Adding Libraries to qmake Projects}.
......@@ -2966,7 +3022,7 @@
\note Shadow building is not supported by the Symbian build system.
Also, shadow building on Windows is not supported for Maemo.
If you only build for one target platform, you can deselect
the \gui{Shadow Build} checkbox.
the \gui{Shadow build} checkbox.
......@@ -2979,6 +3035,23 @@
\image qtcreator-build-steps.png "Build steps"
\section2 Adding Custom Build Steps
To add custom steps to the build settings, select \gui {Add Build Step >
Custom Process Step}.
By default, custom steps are disabled. To activate a custom step, select
the \gui{Enable custom process step} check-box.
\image qtcreator-build-steps-custom.png "Custom Process Step"
You can use any environment variables as values in the fields. For a list
of variable names, click \gui {Build Environment > Details}. You can specify
variables as ${VARNAME} or %VARNAME%. For example, ${BUILDDIR} or %BUILDDIR%.
\note Qt Creator sets SOURCEDIR and BUILDDIR as part of the build environment.
For more information, see \l{Build Environment}.
\section1 Clean Steps
You can use the cleaning process to remove intermediate files. This process
......@@ -2990,10 +3063,10 @@
You can define the cleaning steps for your builds in the \gui{Clean Steps}:
\o To add a clean step using make or a custom process, click
\gui{Add clean step} and select the type of step you want to add.
\gui{Add Clean Step} and select the type of step you want to add.
By default, custom steps are disabled. Activate custom steps by
checking the \gui{Enable custom process step} check-box.
By default, custom steps are disabled. To activate a custom step,
select the \gui{Enable custom process step} check-box.
\o To remove a clean step, click \gui{Remove Item}.
\o To change the order of steps, click
\inlineimage qtcreator-movestep.png
......@@ -3010,6 +3083,8 @@
variables or add, reset and unset new variables based on your project
\image qtcreator-build-environment.png "Build Environment"
......@@ -4610,17 +4685,21 @@
\title Managing Sessions
When you exit Qt Creator, a snapshot of your current workspace is stored
as a session.
A session is a collection of:
as a \e session. A session is an arbitrary collection of:
\o Open projects with their dependencies
\o Open projects with their dependencies (including SUBDIRS projects)
\o Open editors
\o Breakpoints and watches
\o Bookmarks
If you work on a project and need to switch to another project for a
A session is personal, that is, not meant to be shared. It is not
supposed to reflect the project structure. It contains personal data, such as
bookmarks and breakpoints that are usually not of interest to other developers
working on the same projects.
For example, if you work on a project and need to switch to another project for a
while, you can save your workspace as a session. This makes it easier
to return to working on the first project later.
......@@ -31,6 +31,26 @@ defineReplace(qtLibraryName) {
defineTest(minQtVersion) {
maj = $$1
min = $$2
patch = $$3
isEqual(QT_MAJOR_VERSION, $$maj) {
isEqual(QT_MINOR_VERSION, $$min) {
isEqual(QT_PATCH_VERSION, $$patch) {
greaterThan(QT_PATCH_VERSION, $$patch) {
greaterThan(QT_MINOR_VERSION, $$min) {
# For use in custom compilers which just copy files
win32:i_flag = i
defineReplace(stripSrcDir) {
......@@ -693,7 +693,8 @@ def makeValue(type, init):
type = stripClassTag(type)
if type.find(":") >= 0:
type = "'" + type + "'"
gdb.execute("set $d = (%s*)malloc(sizeof(%s))" % (type, type))
# Avoid malloc symbol clash with QVector
gdb.execute("set $d = (%s*)calloc(sizeof(%s), 1)" % (type, type))
gdb.execute("set *$d = {%s}" % init)
value = parseAndEvaluate("$d").dereference()
#warn(" TYPE: %s" % value.type)
......@@ -723,7 +723,8 @@ def qdump__QObject(d, item):
if d.isExpandedIName(item.iname + ".properties"):
# FIXME: Make this global. Don't leak.
variant = "'%sQVariant'" % d.ns
gdb.execute("set $d = (%s*)malloc(sizeof(%s))" % (variant, variant))
# Avoid malloc symbol clash with QVector
gdb.execute("set $d = (%s*)calloc(sizeof(%s), 1)" % (variant, variant))
gdb.execute("set $d.d.is_shared = 0")
with Children(d, [propertyCount, 500]):
......@@ -769,7 +770,8 @@ def qdump__QObject(d, item):
# % (d.ns, item.value.address, propertyName)
#exp = '"((\'%sQObject\'*)%s)"' % (d.ns, item.value.address,)
#warn("EXPRESSION: %s" % exp)
value = call(item.value, 'property("%s")' % propertyName)
value = call(item.value, 'property(%s)'
% cleanAddress(metaStringData + metaData[offset]))
value1 = value["d"]
#warn(" CODE: %s" % value1["type"])
# Type 1 and 2 are bool and int. Try to save a few cycles in this case:
This is Creator's default directory for syntax highlight definitions.
You can download them through the Generic Highlighter options dialog.
<?xml version="1.0" encoding="UTF-8"?>
<type name="QmlProject.Project">
<export module="QmlProject" version="1.0" type="Project"/>
<property name="sourceDirectory" type="string"/>
<property name="importPaths" type="string" isList="true"/>
<property name="content" type="QmlProjectItem" isList="true"/>
......@@ -14,14 +17,26 @@
<property name="files" type="string" isList="true"/>
<type name="QmlProject.QmlFiles" extends="FileFilterBaseItem">
<export module="QmlProject" version="1.0" type="QmlFiles"/>
<type name="QmlProject.JavaScriptFiles" extends="FileFilterBaseItem">
<export module="QmlProject" version="1.0" type="JavaScriptFiles"/>
<property name="filter" type="string"/>
<type name="QmlProject.ImageFiles" extends="FileFilterBaseItem">
<export module="QmlProject" version="1.0" type="ImageFiles"/>
<property name="filter" type="string"/>
<type name="QmlProject.CssFiles" extends="FileFilterBaseItem">
<export module="QmlProject" version="1.0" type="CssFiles"/>
<property name="filter" type="string"/>
<?xml version="1.0" encoding="UTF-8"?>
<type name="QDeclarativeViewer.Screen">
<export module="QDeclarativeViewer" version="1.0" type="Screen"/>
<enum name="Orientation">
<enumerator name="UnknownOrientation" value="0"/>
<enumerator name="Portrait" value="1"/>
......@@ -15,15 +15,15 @@
#include <QtDeclarative/private/qdeclarativeopenmetaobject_p.h>
#include <QtDeclarative/QDeclarativeView>
static QHash<QByteArray, const QDeclarativeType *> qmlTypeByCppName;
static QHash<QByteArray, QByteArray> cppToQml;
static QHash<QByteArray, QList<const QDeclarativeType *> > qmlTypesByCppName;
static QHash<QByteArray, QByteArray> cppToId;
QByteArray convertToQmlType(const QByteArray &cppName)
QByteArray convertToId(const QByteArray &cppName)
QByteArray qmlName = cppToQml.value(cppName, cppName);
qmlName.replace("::", ".");
qmlName.replace("/", ".");
return qmlName;
QByteArray idName = cppToId.value(cppName, cppName);
idName.replace("::", ".");
idName.replace("/", ".");
return idName;
void erasure(QByteArray *typeName, bool *isList, bool *isPointer)
......@@ -41,7 +41,7 @@ void erasure(QByteArray *typeName, bool *isList, bool *isPointer)
erasure(typeName, isList, isPointer);
*typeName = convertToQmlType(*typeName);
*typeName = convertToId(*typeName);
void processMetaObject(const QMetaObject *meta, QSet<const QMetaObject *> *metas)
......@@ -132,7 +132,7 @@ void dump(const QMetaMethod &meth, QXmlStreamWriter *xml)
attributes.append(QXmlStreamAttribute("name", name));
const QString typeName = convertToQmlType(meth.typeName());
const QString typeName = convertToId(meth.typeName());
if (! typeName.isEmpty())
attributes.append(QXmlStreamAttribute("type", typeName));
......@@ -187,16 +187,12 @@ public:
void dump(const QMetaObject *meta, QXmlStreamWriter *xml)
QByteArray qmlTypeName = convertToQmlType(meta->className());
QByteArray id = convertToId(meta->className());
QXmlStreamAttributes attributes;
attributes.append(QXmlStreamAttribute("name", qmlTypeName));
if (const QDeclarativeType *qmlTy = qmlTypeByCppName.value(meta->className())) {
attributes.append(QXmlStreamAttribute("version", QString("%1.%2").arg(qmlTy->majorVersion()).arg(qmlTy->minorVersion())));
attributes.append(QXmlStreamAttribute("name", id));
for (int index = meta->classInfoCount() - 1 ; index >= 0 ; --index) {
QMetaClassInfo classInfo = meta->classInfo(index);
......@@ -206,16 +202,31 @@ void dump(const QMetaObject *meta, QXmlStreamWriter *xml)
QString version;
if (meta->superClass())
attributes.append(QXmlStreamAttribute("extends", convertToQmlType(meta->superClass()->className())));
if (! version.isEmpty())
attributes.append(QXmlStreamAttribute("version", version));
attributes.append(QXmlStreamAttribute("extends", convertToId(meta->superClass()->className())));
QList<const QDeclarativeType *> qmlTypes = qmlTypesByCppName.value(id);
if (!qmlTypes.isEmpty()) {
foreach (const QDeclarativeType *qmlTy, qmlTypes) {
QXmlStreamAttributes moduleAttributes;
const QString qmlTyName = qmlTy->qmlTypeName();
int slashIdx = qmlTyName.lastIndexOf(QLatin1Char('/'));
if (slashIdx == -1)
const QString moduleName = qmlTyName.left(slashIdx);
const QString typeName = qmlTyName.mid(slashIdx + 1);
moduleAttributes.append(QXmlStreamAttribute("module", moduleName));
moduleAttributes.append(QXmlStreamAttribute("version", QString("%1.%2").arg(qmlTy->majorVersion()).arg(qmlTy->minorVersion())));
moduleAttributes.append(QXmlStreamAttribute("type", typeName));
for (int index = meta->enumeratorOffset(); index < meta->enumeratorCount(); ++index)
dump(meta->enumerator(index), xml);
......@@ -234,7 +245,7 @@ void writeEasingCurve(QXmlStreamWriter *xml)
QXmlStreamAttributes attributes;
attributes.append(QXmlStreamAttribute("name", "QEasingCurve"));
attributes.append(QXmlStreamAttribute("extends", "Qt.Easing"));
attributes.append(QXmlStreamAttribute("extends", "QDeclarativeEasingValueType"));
......@@ -262,8 +273,22 @@ int main(int argc, char *argv[])
if (!pluginImportPath.isEmpty())
bool hasQtQuickModule = false;
QByteArray code = "import QtQuick 1.0; Item {}";
QDeclarativeComponent c(engine);
c.setData(code, QUrl("xxx"));
if (c.errors().isEmpty()) {
hasQtQuickModule = true;
QByteArray importCode;
importCode += "import Qt 4.7;\n";
if (hasQtQuickModule) {
importCode += "import QtQuick 1.0;\n";
if (pluginImportName.isEmpty()) {
importCode += "import Qt.labs.particles 4.7;\n";
importCode += "import Qt.labs.gestures 4.7;\n";
......@@ -284,25 +309,25 @@ int main(int argc, char *argv[])
qDebug() << c.errorString();
cppToQml.insert("QString", "string");
cppToQml.insert("QDeclarativeEasingValueType::Type", "Type");
cppToId.insert("QString", "string");