Commit 38b61177 authored by Eike Ziller's avatar Eike Ziller
Browse files

Merge remote-tracking branch 'origin/2.7'

Conflicts:
	share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp
	share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.h
	tests/auto/treeviewfind/treeviewfind.pro

Change-Id: I1ec788373656c947b50d72df6c26c91312469692
parents 48687fd8 c4be740b
......@@ -37,27 +37,28 @@ Installation ("make install") is not needed. It is however possible, using
make install INSTALL_ROOT=$INSTALL_DIRECTORY
Compiling Qt Quick Designer
Private Header Dependencies
---------------------------
Qt Quick Designer (QmlDesigner plugin) depends on "private" headers from Qt
4.8.0, specifically from the QtDeclarative module. These private headers always
end with an "_p.h". Digia does not promise to keep these files or APIs binary
or source compatible between releases. This means that when compiled, the
plugin has a dependency to the exact Qt version it was compiled with. Running
Qt Creator with the plugin against updated Qt libraries (also for patch
releases) might lead to link time failures, or even crashes.
The Qt Quick Designer and the QNX plugin, and on Windows the Utils library,use
private headers of Qt. These private headers always end with an "_p.h". Digia
and the Qt Project do not promise to keep these files or APIs binary or source
compatible between releases. This means that when compiled, Qt Creator has a
dependency to the exact Qt version it was compiled with. Running Qt Creator
against updated Qt libraries (also for patch releases) might lead to link time
failures, or even crashes.
If you want to disable the plugin, you can pass "QT_PRIVATE_HEADERS=" to qmake:
If you want to disable the plugins on Linux and Mac OS X, you can pass
"QT_PRIVATE_HEADERS=" to qmake:
qmake "QT_PRIVATE_HEADERS=" $SOURCE_DIRECTORY/qtcreator.pro
The plugin is not compiled if the private header files are not found. This
might be the case when you use a Qt version from your distribution, or
installed a self-compiled Qt to a separate directory via 'make install'. You
can fix this by either re-building your Qt with the "-developer-build"
configure option, or by passing the include directory in the source directory
to qmake. For example:
The plugins are also automatically omitted if the private header files are
not found. This might be the case when you use a Qt version from your
distribution, or installed a self-compiled Qt to a separate directory via
'make install'. You can fix this by either re-building your Qt with the
"-developer-build" configure option, or by passing the include directory in
the source directory to qmake. For example:
qmake "QT_PRIVATE_HEADERS=$$QT_BUILD_TREE/include" $SOURCE_DIRECTORY/qtcreator.pro
......
......@@ -26,7 +26,7 @@
\contentspage index.html
\previouspage creator-overview.html
\page creator-quick-tour.html
\nextpage creator-build-example-application.html
\nextpage creator-configuring.html
\title User Interface
......
/****************************************************************************
**
** Copyright (c) 2013 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 index.html
\previouspage creator-quick-tour.html
\page creator-configuring.html
\nextpage creator-build-example-application.html
\title Configuring Qt Creator
If you install \QC as part of a Qt installation, you should be able to use
it out-of-the-box, with the default settings and configuration options.
However, if you install the stand-alone \QC package, build \QC from sources,
or install several Qt versions, you may need to tell \QC where to find the
Qt versions and compilers by adding the paths to them and by creating
\l{glossary-buildandrun-kit}{kits} that use them.
To make \QC behave more like your favorite code editor or IDE, you can
change the settings for keyboard shortcuts, color schemes, generic
highlighting, code snippets, and version control systems. In addition, you
can enable experimental plugins and disable plugins that you do not need.
The following sections summarize the options that you have and point you to
detailed information to help you specify any required settings and to make
using \QC a better experience for you.
\section1 Checking Build and Run Settings
\QC is an integrated development environment (IDE) that you can use to
develop Qt applications. While Qt installers typically install \QC,
stand-alone \QC installers never install Qt or any Qt tools, such as qmake.
To use \QC for Qt development, you also need to have a Qt version and a
compiler installed.
Qt installers, such as SDKs, often attempt to auto-detect the installed
compilers and Qt versions. If they succeed, the relevant kits will
automatically become available in \QC. If they do not, you must add the kits
yourself to tell \QC where everything is.
To add kits, select \gui Tools > \gui Options > \gui {Build & Run} >
\gui Kits > \gui Add.
For more information, see \l{Adding Kits}.
Each kit consists of a set of values that define one environment, such as a
device, compiler, and Qt version. If you know you have installed a Qt
version, but it is not listed in \gui Tools > \gui Options >
\gui {Build & Run} > \gui {Qt Versions}, you must add it.
For more information, see \l{Adding Qt Versions}.
Also check that your compiler is listed in \gui Tools > \gui Options >
\gui {Build & Run} > \gui {Compilers}.
For more information, see \l{Adding Compilers}.
You can connect mobile devices to the development PC to run, debug,
and analyze applications on them from \QC. You can connect the device to the
development PC via USB. Additionally, you can connect Linux-based devices
over a WLAN. You must also configure a connection between \QC and the
development PC and specify the device in a kit.
To add devices, select \gui Tools > \gui Options > \gui Devices > \gui Add.
For more information, see \l{Connecting Mobile Devices}.
\section1 Changing Keyboard Shortcuts
You can use \QC with your favorite keyboard shortcuts.
To view and edit all keyboard shortcuts defined in \QC, select
\gui Tools > \gui Options > \gui Environment > \gui Keyboard.
For more information, see \l{Keyboard Shortcuts}.
\section1 Changing Color Schemes
You can use \QC with your favorite color scheme that defines how code
elements are highlighted and which background color is used. You can select
one of the predefined color schemes or create custom ones.
The color schemes apply to highlighting C++ files, QML files, and generic
files.
To change the color scheme, select \gui Tools > \gui Options >
\gui {Text Editor} > \gui {Fonts & Color}.
For more information, see \l{Defining Color Schemes}.
Generic highlighting is based on highlight definition files that are
provided by the
\l{http://kate-editor.org/2005/03/24/writing-a-syntax-highlighting-file/}
{Kate Editor}. You can download highlight definition files for use with \QC.
To download and use highlight definition files, select \gui Tools >
\gui Options > \gui {Text Editor} > \gui {Generic Highlighter}.
For more information, see \l{Generic Highlighting}.
\section1 Adding Your Own Code Snippets
As you write code, \QC suggests properties, IDs, and code snippets to
complete the code. It provides a list of context-sensitive suggestions to
the statement currently under your cursor. You can add, modify,
and remove snippets in the snippet editor.
To open the snippet editor, select \gui Tools > \gui Options >
\gui {Text Editor} > \gui Snippets.
For more information, see \l{Editing Code Snippets}.
\section1 Configuring Version Control Systems
\QC supports several version control systems. In most cases, you do not need
to configure the version control in any special way to make it work with
\QC. Once it is set up correctly on the development PC, it should just work.
However, some configuration options are available and you can set them in
\gui Tools > \gui Options > \gui{Version Control} > \gui Common.
For more information about the supported functions, see
\l{Using Version Control Systems}.
\section1 Enabling and Disabling Plugins
New \QC plugins are often introduced as \e {experimental plugins} to let
you try them out before they are fully supported. Experimental plugins
are disabled by default and you must enable them for them to become visible
after you restart \QC.
You can also disable plugins that you do not use, to streamline \QC.
However, this might cause problems when using another plugin later if the
dependencies between plugins are changed between \QC versions. Once you
manually disable a plugin, it stays disabled even when you upgrade to a
new \QC version, and you must manually enable it to be able to use it.
To enable and disable plugins, select \gui Help > \gui {About Plugins}.
*/
......@@ -24,7 +24,7 @@
/*!
\contentspage index.html
\previouspage creator-quick-tour.html
\previouspage creator-configuring.html
\page creator-build-example-application.html
\nextpage creator-tutorials.html
......
......@@ -46,6 +46,7 @@
\list
\li \l{IDE Overview}
\li \l{User Interface}
\li \l{Configuring Qt Creator}
\li \l{Building and Running an Example}
\li \l{Tutorials}
\endlist
......@@ -147,6 +148,7 @@
\list
\li \l{IDE Overview}
\li \l{User Interface}
\li \l{Configuring Qt Creator}
\li \l{Building and Running an Example}
\li \l{Tutorials}
\list
......
......@@ -81,8 +81,8 @@ QString InformationContainer::nameAsString() const
return QLatin1String("PenWidth");
case Position:
return QLatin1String("Position");
case IsInPositioner:
return QLatin1String("IsInPositioner");
case IsInLayoutable:
return QLatin1String("IsInLayoutable");
case SceneTransform:
return QLatin1String("SceneTransform");
case IsResizable:
......
......@@ -33,16 +33,25 @@
namespace QmlDesigner {
static TypeName properDelemitingOfType(const TypeName &typeName)
{
TypeName convertedTypeName = typeName;
int lastIndex = typeName.lastIndexOf('.');
if (lastIndex > 0)
convertedTypeName[lastIndex] = '/';
return convertedTypeName;
}
InstanceContainer::InstanceContainer()
: m_instanceId(-1), m_majorNumber(-1), m_minorNumber(-1)
{
}
InstanceContainer::InstanceContainer(qint32 instanceId, const TypeName &type, int majorNumber, int minorNumber, const QString &componentPath, const QString &nodeSource, NodeSourceType nodeSourceType, NodeMetaType metaType)
: m_instanceId(instanceId), m_type(type), m_majorNumber(majorNumber), m_minorNumber(minorNumber), m_componentPath(componentPath),
: m_instanceId(instanceId), m_type(properDelemitingOfType(type)), m_majorNumber(majorNumber), m_minorNumber(minorNumber), m_componentPath(componentPath),
m_nodeSource(nodeSource), m_nodeSourceType(nodeSourceType), m_metaType(metaType)
{
m_type.replace('.', '/');
}
qint32 InstanceContainer::instanceId() const
......
......@@ -47,7 +47,7 @@ enum InformationName
InstanceTypeForProperty,
PenWidth,
Position,
IsInPositioner,
IsInLayoutable,
SceneTransform,
IsResizable,
IsMovable,
......
#include "graphicalnodeinstance.h"
#include "qt5nodeinstanceserver.h"
#include <QQmlExpression>
#include <cmath>
#include <QQuickView>
#include <private/qquickitem_p.h>
#include <private/qquicktextinput_p.h>
#include <private/qquicktextedit_p.h>
namespace QmlDesigner {
namespace Internal {
bool GraphicalNodeInstance::s_createEffectItem = false;
GraphicalNodeInstance::GraphicalNodeInstance(QObject *object)
: ObjectNodeInstance(object),
m_hasHeight(false),
m_hasWidth(false),
m_hasContent(true),
m_x(0.0),
m_y(0.0),
m_width(0.0),
m_height(0.0)
{
}
void GraphicalNodeInstance::setHasContent(bool hasContent)
{
m_hasContent = hasContent;
}
DesignerSupport *GraphicalNodeInstance::designerSupport() const
{
return qt5NodeInstanceServer()->designerSupport();
}
Qt5NodeInstanceServer *GraphicalNodeInstance::qt5NodeInstanceServer() const
{
return qobject_cast<Qt5NodeInstanceServer*>(nodeInstanceServer());
}
bool GraphicalNodeInstance::isGraphical() const
{
return true;
}
bool GraphicalNodeInstance::anyItemHasContent(QQuickItem *quickItem)
{
if (quickItem->flags().testFlag(QQuickItem::ItemHasContents))
return true;
foreach (QQuickItem *childItem, quickItem->childItems()) {
if (anyItemHasContent(childItem))
return true;
}
return false;
}
double GraphicalNodeInstance::x() const
{
return m_x;
}
double GraphicalNodeInstance::y() const
{
return m_y;
}
QQuickItem *GraphicalNodeInstance::quickItem() const
{
return 0;
}
bool GraphicalNodeInstance::childItemsHaveContent(QQuickItem *quickItem)
{
foreach (QQuickItem *childItem, quickItem->childItems()) {
if (anyItemHasContent(childItem))
return true;
}
return false;
}
bool GraphicalNodeInstance::hasContent() const
{
if (m_hasContent)
return true;
return childItemsHaveContent(quickItem());
}
void GraphicalNodeInstance::createEffectItem(bool createEffectItem)
{
s_createEffectItem = createEffectItem;
}
void GraphicalNodeInstance::updateDirtyNodeRecursive()
{
foreach (QQuickItem *childItem, quickItem()->childItems())
updateDirtyNodeRecursive(childItem);
DesignerSupport::updateDirtyNode(quickItem());
}
GraphicalNodeInstance::~GraphicalNodeInstance()
{
if (quickItem())
designerSupport()->derefFromEffectItem(quickItem());
}
void GraphicalNodeInstance::updateDirtyNodeRecursive(QQuickItem *parentItem) const
{
foreach (QQuickItem *childItem, parentItem->childItems()) {
if (!nodeInstanceServer()->hasInstanceForObject(childItem))
updateDirtyNodeRecursive(childItem);
}
DesignerSupport::updateDirtyNode(parentItem);
}
void GraphicalNodeInstance::updateAllDirtyNodeRecursive(QQuickItem *parentItem) const
{
foreach (QQuickItem *childItem, parentItem->childItems())
updateDirtyNodeRecursive(childItem);
DesignerSupport::updateDirtyNode(parentItem);
}
QImage GraphicalNodeInstance::renderImage() const
{
updateDirtyNodeRecursive(quickItem());
QRectF boundingRect = boundingRectWithStepChilds(quickItem());
QImage renderImage = designerSupport()->renderImageForItem(quickItem(), boundingRect, boundingRect.size().toSize());
renderImage = renderImage.convertToFormat(QImage::Format_ARGB32_Premultiplied);
return renderImage;
}
QImage GraphicalNodeInstance::renderPreviewImage(const QSize &previewImageSize) const
{
QRectF previewItemBoundingRect = boundingRect();
if (previewItemBoundingRect.isValid() && quickItem())
return designerSupport()->renderImageForItem(quickItem(), previewItemBoundingRect, previewImageSize);
return QImage();
}
void GraphicalNodeInstance::initialize(const ObjectNodeInstance::Pointer &objectNodeInstance)
{
if (instanceId() == 0) {
DesignerSupport::setRootItem(nodeInstanceServer()->quickView(), quickItem());
} else {
quickItem()->setParentItem(qobject_cast<QQuickItem*>(nodeInstanceServer()->quickView()->rootObject()));
}
if (s_createEffectItem || instanceId() == 0)
designerSupport()->refFromEffectItem(quickItem());
ObjectNodeInstance::initialize(objectNodeInstance);
quickItem()->update();
}
QPointF GraphicalNodeInstance::position() const
{
return quickItem()->position();
}
QTransform GraphicalNodeInstance::customTransform() const
{
return QTransform();
}
QTransform GraphicalNodeInstance::sceneTransform() const
{
return DesignerSupport::windowTransform(quickItem());
}
double GraphicalNodeInstance::rotation() const
{
return quickItem()->rotation();
}
double GraphicalNodeInstance::scale() const
{
return quickItem()->scale();
}
QPointF GraphicalNodeInstance::transformOriginPoint() const
{
return quickItem()->transformOriginPoint();
}
double GraphicalNodeInstance::zValue() const
{
return quickItem()->z();
}
double GraphicalNodeInstance::opacity() const
{
return quickItem()->opacity();
}
QSizeF GraphicalNodeInstance::size() const
{
double width;
if (DesignerSupport::isValidWidth(quickItem())) {
width = quickItem()->width();
} else {
width = quickItem()->implicitWidth();
}
double height;
if (DesignerSupport::isValidHeight(quickItem())) {
height = quickItem()->height();
} else {
height = quickItem()->implicitHeight();
}
return QSizeF(width, height);
}
static inline bool isRectangleSane(const QRectF &rect)
{
return rect.isValid() && (rect.width() < 10000) && (rect.height() < 10000);
}
QRectF GraphicalNodeInstance::boundingRectWithStepChilds(QQuickItem *parentItem) const
{
QRectF boundingRect = parentItem->boundingRect();
foreach (QQuickItem *childItem, parentItem->childItems()) {
if (!nodeInstanceServer()->hasInstanceForObject(childItem)) {
QRectF transformedRect = childItem->mapRectToItem(parentItem, boundingRectWithStepChilds(childItem));
if (isRectangleSane(transformedRect))
boundingRect = boundingRect.united(transformedRect);
}
}
return boundingRect;
}
void GraphicalNodeInstance::resetHorizontal()
{
setPropertyVariant("x", m_x);
if (m_width > 0.0) {
setPropertyVariant("width", m_width);
} else {
setPropertyVariant("width", quickItem()->implicitWidth());
}
}
void GraphicalNodeInstance::resetVertical()
{
setPropertyVariant("y", m_y);
if (m_height > 0.0) {
setPropertyVariant("height", m_height);
} else {
setPropertyVariant("height", quickItem()->implicitWidth());
}
}
int GraphicalNodeInstance::penWidth() const
{
return DesignerSupport::borderWidth(quickItem());
}
QList<ServerNodeInstance> GraphicalNodeInstance::childItemsForChild(QQuickItem *childItem) const
{
QList<ServerNodeInstance> instanceList;
if (childItem) {
foreach (QQuickItem *childItem, childItem->childItems())
{
if (childItem && nodeInstanceServer()->hasInstanceForObject(childItem)) {
instanceList.append(nodeInstanceServer()->instanceForObject(childItem));
} else {
instanceList.append(childItemsForChild(childItem));
}
}
}
return instanceList;
}
QList<ServerNodeInstance> GraphicalNodeInstance::childItems() const
{
QList<ServerNodeInstance> instanceList;
foreach (QQuickItem *childItem, quickItem()->childItems())
{