Commit 49db3a45 authored by Eike Ziller's avatar Eike Ziller

Merge remote-tracking branch 'origin/3.2'

Conflicts:
	qtcreator.pri
	qtcreator.qbs
	src/plugins/coreplugin/editormanager/editormanager.cpp
	src/plugins/cppeditor/cppeditor.cpp
	src/plugins/remotelinux/remotelinuxdebugsupport.cpp
	src/plugins/texteditor/basetexteditor.cpp

Change-Id: I0da7c1cf2506b12d0563795aa8177fc45e97050f
parents afd56bd8 d030a960
[Paths]
Imports = ../../../Imports/qtquick1
Qml2Imports = ../../../Imports/qtquick2
Plugins = ../../../PlugIns
......@@ -23,20 +23,14 @@ if [ -d "$5" ]; then
cp -R "$5"/ "$imports2Dir"/
fi
qmlpuppetapp="$1/Contents/MacOS/qmlpuppet.app"
qmlpuppetapp="$1/Contents/MacOS/qmlpuppet"
if [ -d "$qmlpuppetapp" ]; then
qmlpuppetArgument="-executable=$qmlpuppetapp/Contents/MacOS/qmlpuppet"
qmlpuppetResources="$1/Contents/MacOS/qmlpuppet.app/Contents/Resources"
test -d "$qmlpuppetResources" || mkdir -p "$qmlpuppetResources"
cp "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/qmlpuppet_qt.conf" "$qmlpuppetResources/qt.conf" || exit 1
qmlpuppetArgument="-executable=$qmlpuppetapp"
fi
qml2puppetapp="$1/Contents/MacOS/qml2puppet.app"
qml2puppetapp="$1/Contents/MacOS/qml2puppet"
if [ -d "$qml2puppetapp" ]; then
qml2puppetArgument="-executable=$qml2puppetapp/Contents/MacOS/qml2puppet"
qml2puppetResources="$1/Contents/MacOS/qml2puppet.app/Contents/Resources"
test -d "$qml2puppetResources" || mkdir -p "$qml2puppetResources"
cp "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/qmlpuppet_qt.conf" "$qml2puppetResources/qt.conf" || exit 1
qml2puppetArgument="-executable=$qml2puppetapp"
fi
macdeployqt "$1" \
......@@ -66,6 +60,6 @@ if [ $LLVM_INSTALL_DIR ]; then
if [ ! -f "$_CLANG_CODEMODEL_LIB" ]; then
_CLANG_CODEMODEL_LIB="$1/Contents/PlugIns/libClangCodeModel.dylib"
fi
xcrun install_name_tool -rpath "$LLVM_INSTALL_DIR/lib" "@loader_path/.." "$_CLANG_CODEMODEL_LIB" || true
xcrun install_name_tool -rpath "$LLVM_INSTALL_DIR/lib" "@loader_path/" "$_CLANG_CODEMODEL_LIB" || true
fi
......@@ -53,6 +53,7 @@
#include <private/qquickanimation_p.h>
#include <private/qqmltimer_p.h>
#include <private/qqmlengine_p.h>
#include <private/qqmlexpression_p.h>
#include <designersupport.h>
......@@ -102,8 +103,6 @@ static bool isSimpleExpression(const QString &expression)
namespace QmlDesigner {
namespace Internal {
QHash<EnumerationName, QVariant> ObjectNodeInstance::m_enumationValueHash;
ObjectNodeInstance::ObjectNodeInstance(QObject *object)
: m_object(object),
m_metaObject(0),
......@@ -474,6 +473,37 @@ PropertyNameList ObjectNodeInstance::ignoredProperties() const
return PropertyNameList();
}
QVariant ObjectNodeInstance::convertEnumToValue(const QVariant &value, const PropertyName &name)
{
int idx = object()->metaObject()->indexOfProperty(name);
QMetaProperty metaProperty = object()->metaObject()->property(idx);
QVariant fixedValue = fixResourcePaths(value);
if (value.canConvert<Enumeration>()) {
Enumeration enumeration = value.value<Enumeration>();
if (metaProperty.isValid() && metaProperty.isEnumType()) {
fixedValue = metaProperty.enumerator().keyToValue(enumeration.name());
} else if (metaProperty.isValid()
&& (QLatin1String(metaProperty.typeName()) == QLatin1String("int"))) {
//If the target property is an integer handle an enum as binding
QQmlExpression expression(context(), object(), enumeration.toString());
fixedValue = expression.evaluate();
if (expression.hasError())
qDebug() << "Enum can not be evaluated:" << object() << name << enumeration;
} else if (!metaProperty.isValid()) { //In this case this is most likely an attached property
QQmlExpression expression(context(), object(), enumeration.toString());
fixedValue = expression.evaluate();
if (expression.hasError())
qDebug() << "Enum can not be evaluated:" << object() << name << enumeration;
}
}
return fixedValue;
}
void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVariant &value)
{
if (ignoredProperties().contains(name))
......@@ -485,9 +515,7 @@ void ObjectNodeInstance::setPropertyVariant(const PropertyName &name, const QVar
return;
QVariant fixedValue = fixResourcePaths(value);
if (value.canConvert<Enumeration>())
fixedValue = enumationValue(value.value<Enumeration>());
fixedValue = convertEnumToValue(fixedValue, name);
QVariant oldValue = property.read();
if (oldValue.type() == QVariant::Url) {
......@@ -1342,43 +1370,6 @@ void ObjectNodeInstance::doComponentCompleteRecursive(QObject *object, NodeInsta
}
}
static QHash<EnumerationName, QVariant> enumationValuesFromMetaEnum(const QMetaEnum &metaEnum)
{
QHash<EnumerationName, QVariant> enumationValues;
for (int index = 0; index < metaEnum.keyCount(); index++) {
EnumerationName enumerationName = EnumerationName(metaEnum.scope()) + "." + metaEnum.key(index);
enumationValues.insert(enumerationName, QVariant::fromValue(metaEnum.value(index)));
qDebug() << __FUNCTION__ << enumerationName << metaEnum.value(index);
}
return enumationValues;
}
static QHash<EnumerationName, QVariant> collectEnumationValues(const Enumeration &enumeration)
{
QHash<EnumerationName, QVariant> enumationValues;
EnumerationName enumerationScope = enumeration.scope();
const QMetaObject *metaObject = QMetaType::metaObjectForType(QMetaType::type(enumerationScope.constData()));
if (metaObject) {
int enumeratorCount = metaObject->enumeratorOffset() + metaObject->enumeratorCount();
for (int index = metaObject->enumeratorOffset(); index < enumeratorCount; index++)
enumationValues.unite(enumationValuesFromMetaEnum(metaObject->enumerator(index)));
} else {
enumationValues.insert(enumeration.toEnumerationName(), QVariant::fromValue(enumeration.nameToString()));
}
return enumationValues;
}
QVariant ObjectNodeInstance::enumationValue(const Enumeration &enumeration)
{
EnumerationName enumerationName = enumeration.toEnumerationName();
if (!m_enumationValueHash.contains(enumerationName))
m_enumationValueHash.unite(collectEnumationValues(enumeration));
return m_enumationValueHash.value(enumerationName);
}
ObjectNodeInstance::Pointer ObjectNodeInstance::parentInstance() const
{
QObject *parentHolder = parent();
......
......@@ -200,6 +200,7 @@ protected:
void addToNewProperty(QObject *object, QObject *newParent, const PropertyName &newParentProperty);
void deleteObjectsInList(const QQmlProperty &metaProperty);
QVariant convertSpecialCharacter(const QVariant& value) const;
QVariant convertEnumToValue(const QVariant &value, const PropertyName &name);
static QObject *parentObject(QObject *object);
static void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInstanceServer);
static QVariant enumationValue(const Enumeration &enumeration);
......
......@@ -44,17 +44,21 @@ Column {
property alias caption: label.text
property variant backendendValue
property variant backendValue
property variant value: backendendValue.value
property variant value: backendValue.value
property alias gradientPropertyName: gradientLine.gradientPropertyName
function isNotInGradientMode() {
return (buttonRow.checkedIndex !== 1)
}
onValueChanged: {
colorEditor.color = colorEditor.value
}
onBackendendValueChanged: {
onBackendValueChanged: {
colorEditor.color = colorEditor.value
}
......@@ -64,8 +68,8 @@ Column {
interval: 100
running: false
onTriggered: {
if (backendendValue !== undefined)
backendendValue.value = colorEditor.color
if (backendValue !== undefined)
backendValue.value = colorEditor.color
}
}
......@@ -78,7 +82,7 @@ Column {
gradientLine.currentColor = color
}
if (buttonRow.checkedIndex !== 1) {
if (isNotInGradientMode()) {
//Delay setting the color to keep ui responsive
colorEditorTimer.restart()
}
......@@ -164,12 +168,18 @@ Column {
showTranslateCheckBox: false
backendValue: colorEditor.backendendValue
backendValue: colorEditor.backendValue
onAccepted: {
colorEditor.color = colorFromString(textField.text)
}
onCommitData: {
colorEditor.color = colorFromString(textField.text)
if (isNotInGradientMode())
backendValue.value = colorEditor.color
}
Layout.fillWidth: true
}
ColorCheckButton {
......@@ -185,7 +195,7 @@ Column {
ButtonRowButton {
iconSource: "images/icon_color_solid.png"
onClicked: {
colorEditor.backendendValue.resetValue()
colorEditor.backendValue.resetValue()
gradientLine.deleteGradient()
}
toolTip: qsTr("Solid Color")
......@@ -194,7 +204,7 @@ Column {
visible: supportGradient
iconSource: "images/icon_color_gradient.png"
onClicked: {
colorEditor.backendendValue.resetValue()
colorEditor.backendValue.resetValue()
gradientLine.addGradient()
}
......
......@@ -53,6 +53,8 @@ Controls.TextField {
property bool showExtendedFunctionButton: true
signal commitData
ExtendedFunctionButton {
x: 2
y: 4
......@@ -82,7 +84,10 @@ Controls.TextField {
onSelectionToBeChanged: {
if (__dirty && !writeValueManually) {
lineEdit.backendValue.value = text
} else if (__dirty) {
commitData()
}
__dirty = false
}
}
......
......@@ -3,6 +3,6 @@ Item {
ColorEditor {
caption: "%1"
backendColor: backendValues.%2
backendValue: backendValues.%2
supportGradient: false
}
\ No newline at end of file
}
......@@ -43,7 +43,7 @@ Column {
ColorEditor {
caption: qsTr("Color")
backendendValue: backendValues.color
backendValue: backendValues.color
supportGradient: true
}
......@@ -57,7 +57,7 @@ Column {
ColorEditor {
caption: qsTr("Border Color")
backendendValue: backendValues.border_color
backendValue: backendValues.border_color
supportGradient: false
}
}
......
......@@ -48,7 +48,7 @@ Column {
ColorEditor {
caption: qsTr("Text Color")
backendendValue: backendValues.color
backendValue: backendValues.color
supportGradient: false
}
......@@ -61,7 +61,7 @@ Column {
ColorEditor {
caption: qsTr("Selection Color")
backendendValue: backendValues.selectionColor
backendValue: backendValues.selectionColor
supportGradient: false
}
}
......
......@@ -47,7 +47,7 @@ Column {
ColorEditor {
caption: qsTr("Text Color")
backendendValue: backendValues.color
backendValue: backendValues.color
supportGradient: false
}
......@@ -60,7 +60,7 @@ Column {
ColorEditor {
caption: qsTr("Selection Color")
backendendValue: backendValues.selectionColor
backendValue: backendValues.selectionColor
supportGradient: false
}
}
......
......@@ -49,7 +49,7 @@ Column {
ColorEditor {
caption: qsTr("Text Color")
backendendValue: backendValues.color
backendValue: backendValues.color
supportGradient: false
}
......@@ -62,7 +62,7 @@ Column {
ColorEditor {
caption: qsTr("Style Color")
backendendValue: backendValues.styleColor
backendValue: backendValues.styleColor
supportGradient: false
}
}
......
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="E"
<template openeditor="main.qml" priority="BZ"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.1.1">
<displayname>Qt Quick 1.1</displayname>
<description>Creates a Qt Quick 1 UI project with a single QML file that contains the main view. You can review Qt Quick 1 UI projects in the QML Viewer and you need not build them. You do not need to have the development environment installed on your computer to create and run this type of project. Requires Qt 4.8 or newer.</description>
......
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="D"
<template openeditor="main.qml" priority="BY"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.2.1">
<displayname>Qt Quick 2.1</displayname>
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. You do not need to have the development environment installed on your computer to create and run this type of project. Requires Qt 5.1 or newer.</description>
......
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="C"
<template openeditor="main.qml" priority="BX"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.2.2">
<displayname>Qt Quick 2.2</displayname>
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. You do not need to have the development environment installed on your computer to create and run this type of project. Requires Qt 5.2 or newer.</description>
......
import QtQuick 2.3
Rectangle {
width: 360
height: 360
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
Text {
anchors.centerIn: parent
text: "Hello World"
}
}
/* File generated by Qt Creator, version 2.7.0 */
import QmlProject 1.1
Project {
// QTC_REPLACE main.qml WITH main
mainFile: "main.qml"
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
directory: "."
}
JavaScriptFiles {
directory: "."
}
ImageFiles {
directory: "."
}
/* List of plugin directories passed to QML runtime */
// importPaths: [ "../exampleplugin" ]
}
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="BW"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.2.3">
<displayname>Qt Quick 2.3</displayname>
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view. You can review Qt Quick 2 UI projects in the QML Scene and you need not build them. You do not need to have the development environment installed on your computer to create and run this type of project. Requires Qt 5.3 or newer.</description>
</template>
......@@ -10,6 +10,10 @@ ApplicationWindow {
menuBar: MenuBar {
Menu {
title: qsTr("File")
MenuItem {
text: qsTr("&Open")
onTriggered: console.log("Open action triggered");
}
MenuItem {
text: qsTr("Exit")
onTriggered: Qt.quit();
......
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="B"
<template openeditor="main.qml" priority="AZ"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.Controls.1.0">
<displayname>Qt Quick Controls 1.0</displayname>
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view 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.1 or newer.</description>
......
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Window 2.0
import QtQuick.Window 2.1
ApplicationWindow {
title: qsTr("Hello World")
......@@ -10,6 +10,10 @@ ApplicationWindow {
menuBar: MenuBar {
Menu {
title: qsTr("File")
MenuItem {
text: qsTr("&Open")
onTriggered: console.log("Open action triggered");
}
MenuItem {
text: qsTr("Exit")
onTriggered: Qt.quit();
......
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="A"
<template openeditor="main.qml" priority="AY"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.Controls.1.1">
<displayname>Qt Quick Controls 1.1</displayname>
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view 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.2 or newer.</description>
......
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Window 2.2
ApplicationWindow {
title: qsTr("Hello World")
width: 640
height: 480
menuBar: MenuBar {
Menu {
title: qsTr("File")
MenuItem {
text: qsTr("&Open")
onTriggered: console.log("Open action triggered");
}
MenuItem {
text: qsTr("Exit")
onTriggered: Qt.quit();
}
}
}
Button {
text: qsTr("Hello World")
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
}
/* File generated by Qt Creator, version 2.7.0 */
import QmlProject 1.1
Project {
// QTC_REPLACE main.qml WITH main
mainFile: "main.qml"
/* Include .qml, .js, and image files from current directory and subdirectories */
QmlFiles {
directory: "."
}
JavaScriptFiles {
directory: "."
}
ImageFiles {
directory: "."
}
/* List of plugin directories passed to QML runtime */
// importPaths: [ "../exampleplugin" ]
}
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="AX"
featuresRequired="QtSupport.Wizards.FeatureQtQuickProject, QtSupport.Wizards.FeatureQtQuick.Controls.1.2">
<displayname>Qt Quick Controls 1.2</displayname>
<description>Creates a Qt Quick 2 UI project with a single QML file that contains the main view 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.3 or newer.</description>
</template>
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="E"
<template openeditor="main.qml" priority="BZ"
featuresRequired="QtSupport.Wizards.FeatureQtQuick.1.1"
qrcdeployment="qrcdeployment.pri"
viewerdir="qtquick1applicationviewer"
......
import QtQuick 2.1
import QtQuick.Window 2.1
import QtQuick.Window 2.0
Window {
visible: true
......
<?xml version="1.0" encoding="UTF-8"?>
<template openeditor="main.qml" priority="D"
<template openeditor="main.qml" priority="BY"
featuresRequired="QtSupport.Wizards.FeatureQtQuick.2.1"
qrcdeployment="qrcdeployment.pri"
stubversionminor="5">
......