summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@digia.com>2013-08-12 17:58:31 +0200
committerThomas Hartmann <Thomas.Hartmann@digia.com>2013-08-12 18:01:31 +0200
commit3353b0f253ec6358236a8e95003363aaf9685c3e (patch)
tree9ad6e4baf83e05f1c5eaa5522b79b99ef4fbc5cb
parent13033734a1b1bf88d2f33b5391360a37e9afc6d4 (diff)
downloadqt-creator-3353b0f253ec6358236a8e95003363aaf9685c3e.tar.gz
QmlDesigner: refactoring PropertyEditor
* Renaming PropertyEditor to PropertyEditorView * Adding PropertyEditorWidget * Renaming DeclarativeWidgetView to QuickPropertyEditorView * Renaming NodeType to PropertyEditorQmlBackend * Moving PropertyEditorQmlBackend into separate file * Cleaning up interface of PropertyEditorQmlBackend Change-Id: I1291feb5880b01d1e2bac09f4eb1e0181ff04d5c Reviewed-by: Marco Bubke <marco.bubke@digia.com>
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri16
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp313
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h84
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.cpp2
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.h6
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp (renamed from src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp)488
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.h (renamed from src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h)68
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorwidget.cpp45
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorwidget.h54
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/quickpropertyeditorview.cpp (renamed from src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.cpp)26
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/quickpropertyeditorview.h (renamed from src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.h)13
-rw-r--r--src/plugins/qmldesigner/designercore/include/viewmanager.h4
12 files changed, 674 insertions, 445 deletions
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri
index 85f2b39e57..070cc02dcf 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri
@@ -1,6 +1,6 @@
VPATH += $$PWD
-SOURCES += propertyeditor.cpp \
+SOURCES += propertyeditorview.cpp \
qmlanchorbindingproxy.cpp \
resetwidget.cpp \
qlayoutobject.cpp \
@@ -15,10 +15,12 @@ SOURCES += propertyeditor.cpp \
siblingcombobox.cpp \
propertyeditortransaction.cpp \
propertyeditorcontextobject.cpp \
- declarativewidgetview.cpp \
- gradientlineqmladaptor.cpp
+ quickpropertyeditorview.cpp \
+ gradientlineqmladaptor.cpp \
+ propertyeditorqmlbackend.cpp \
+ propertyeditorwidget.cpp
-HEADERS += propertyeditor.h \
+HEADERS += propertyeditorview.h \
qmlanchorbindingproxy.h \
resetwidget.h \
qlayoutobject.h \
@@ -34,8 +36,10 @@ HEADERS += propertyeditor.h \
propertyeditortransaction.h \
designerpropertymap.h \
propertyeditorcontextobject.h \
- declarativewidgetview.h \
- gradientlineqmladaptor.h
+ quickpropertyeditorview.h \
+ gradientlineqmladaptor.h \
+ propertyeditorqmlbackend.h \
+ propertyeditorwidget.h
QT += declarative
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
new file mode 100644
index 0000000000..3c2d005ace
--- /dev/null
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp
@@ -0,0 +1,313 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "propertyeditorqmlbackend.h"
+
+#include "propertyeditorvalue.h"
+#include "propertyeditortransaction.h"
+
+#include <qmlobjectnode.h>
+#include <nodemetainfo.h>
+#include <variantproperty.h>
+#include <bindingproperty.h>
+
+#include <QApplication>
+#include <QFileInfo>
+
+#ifdef Q_OS_WIN
+#include <utils/winutils.h>
+#endif
+
+enum {
+ debug = false
+};
+
+static QObject *variantToQObject(const QVariant &value)
+{
+ if (value.userType() == QMetaType::QObjectStar || value.userType() > QMetaType::User)
+ return *(QObject **)value.constData();
+
+ return 0;
+}
+
+static QString applicationDirPath()
+{
+#ifdef Q_OS_WIN
+ // normalize paths so QML doesn't freak out if it's wrongly capitalized on Windows
+ return Utils::normalizePathName(QCoreApplication::applicationDirPath());
+#else
+ return QCoreApplication::applicationDirPath();
+#endif
+}
+
+#ifdef Q_OS_MAC
+# define SHARE_PATH "/../Resources/qmldesigner"
+#else
+# define SHARE_PATH "/../share/qtcreator/qmldesigner"
+#endif
+
+static inline QString sharedDirPath()
+{
+ QString appPath = applicationDirPath();
+
+ return QFileInfo(appPath + SHARE_PATH).absoluteFilePath();
+}
+
+namespace QmlDesigner {
+
+PropertyEditorQmlBackend::PropertyEditorQmlBackend(PropertyEditorView *propertyEditor) :
+ m_view(new QuickPropertyEditorView), m_propertyEditorTransaction(new PropertyEditorTransaction(propertyEditor)), m_dummyPropertyEditorValue(new PropertyEditorValue()),
+ m_contextObject(new PropertyEditorContextObject())
+{
+ Q_ASSERT(QFileInfo(":/images/button_normal.png").exists());
+
+ QDeclarativeContext *ctxt = m_view->rootContext();
+ m_view->engine()->setOutputWarningsToStandardError(debug);
+ m_view->engine()->addImportPath(propertyEditorResourcesPath());
+ m_dummyPropertyEditorValue->setValue("#000000");
+ ctxt->setContextProperty("dummyBackendValue", m_dummyPropertyEditorValue.data());
+ m_contextObject->setBackendValues(&m_backendValuesPropertyMap);
+ ctxt->setContextObject(m_contextObject.data());
+
+ QObject::connect(&m_backendValuesPropertyMap, SIGNAL(valueChanged(QString,QVariant)), propertyEditor, SLOT(changeValue(QString)));
+}
+
+PropertyEditorQmlBackend::~PropertyEditorQmlBackend()
+{
+}
+
+void PropertyEditorQmlBackend::setupPropertyEditorValue(const PropertyName &name, PropertyEditorView *propertyEditor, const QString &type)
+{
+ QmlDesigner::PropertyName propertyName(name);
+ propertyName.replace('.', '_');
+ PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(backendValuesPropertyMap().value(propertyName)));
+ if (!valueObject) {
+ valueObject = new PropertyEditorValue(&backendValuesPropertyMap());
+ QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), &backendValuesPropertyMap(), SIGNAL(valueChanged(QString,QVariant)));
+ QObject::connect(valueObject, SIGNAL(expressionChanged(QString)), propertyEditor, SLOT(changeExpression(QString)));
+ backendValuesPropertyMap().insert(QString::fromUtf8(propertyName), QVariant::fromValue(valueObject));
+ }
+ valueObject->setName(propertyName);
+ if (type == "QColor")
+ valueObject->setValue(QVariant("#000000"));
+ else
+ valueObject->setValue(QVariant(1));
+
+}
+
+void PropertyEditorQmlBackend::createPropertyEditorValue(const QmlObjectNode &qmlObjectNode,
+ const PropertyName &name,
+ const QVariant &value,
+ PropertyEditorView *propertyEditor)
+{
+ PropertyName propertyName(name);
+ propertyName.replace('.', '_');
+ PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(backendValuesPropertyMap().value(propertyName)));
+ if (!valueObject) {
+ valueObject = new PropertyEditorValue(&backendValuesPropertyMap());
+ QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), &backendValuesPropertyMap(), SIGNAL(valueChanged(QString,QVariant)));
+ QObject::connect(valueObject, SIGNAL(expressionChanged(QString)), propertyEditor, SLOT(changeExpression(QString)));
+ backendValuesPropertyMap().insert(QString::fromUtf8(propertyName), QVariant::fromValue(valueObject));
+ }
+ valueObject->setName(name);
+ valueObject->setModelNode(qmlObjectNode);
+
+ if (qmlObjectNode.propertyAffectedByCurrentState(name) && !(qmlObjectNode.modelNode().property(name).isBindingProperty()))
+ valueObject->setValue(qmlObjectNode.modelValue(name));
+
+ else
+ valueObject->setValue(value);
+
+ if (propertyName != "id" &&
+ qmlObjectNode.currentState().isBaseState() &&
+ qmlObjectNode.modelNode().property(propertyName).isBindingProperty()) {
+ valueObject->setExpression(qmlObjectNode.modelNode().bindingProperty(propertyName).expression());
+ } else {
+ valueObject->setExpression(qmlObjectNode.instanceValue(name).toString());
+ }
+}
+
+void PropertyEditorQmlBackend::setValue(const QmlObjectNode & qmlObjectNode, const PropertyName &name, const QVariant &value)
+{
+ PropertyName propertyName = name;
+ propertyName.replace('.', '_');
+ PropertyEditorValue *propertyValue = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value(propertyName)));
+ if (propertyValue) {
+ propertyValue->setValue(value);
+ if (!qmlObjectNode.hasBindingProperty(name))
+ propertyValue->setExpression(value.toString());
+ else
+ propertyValue->setExpression(qmlObjectNode.expression(name));
+ }
+}
+
+
+QDeclarativeContext *PropertyEditorQmlBackend::context() {
+ return m_view->rootContext();
+}
+
+PropertyEditorContextObject* PropertyEditorQmlBackend::contextObject() {
+ return m_contextObject.data();
+}
+
+QWidget *PropertyEditorQmlBackend::widget() {
+ return m_view;
+}
+
+void PropertyEditorQmlBackend::setSource(const QUrl& url) {
+ m_view->setSource(url);
+}
+
+Internal::QmlAnchorBindingProxy &PropertyEditorQmlBackend::backendAnchorBinding() {
+ return m_backendAnchorBinding;
+}
+
+DesignerPropertyMap<PropertyEditorValue> &PropertyEditorQmlBackend::backendValuesPropertyMap() {
+ return m_backendValuesPropertyMap;
+}
+
+PropertyEditorTransaction *PropertyEditorQmlBackend::propertyEditorTransaction() {
+ return m_propertyEditorTransaction.data();
+}
+
+PropertyEditorValue *PropertyEditorQmlBackend::propertyValueForName(const QString &propertyName)
+{
+ return qobject_cast<PropertyEditorValue*>(variantToQObject(backendValuesPropertyMap().value(propertyName)));
+}
+
+void PropertyEditorQmlBackend::setup(const QmlObjectNode &qmlObjectNode, const QString &stateName, const QUrl &qmlSpecificsFile, PropertyEditorView *propertyEditor)
+{
+ if (!qmlObjectNode.isValid())
+ return;
+
+ QDeclarativeContext *ctxt = m_view->rootContext();
+
+ if (qmlObjectNode.isValid()) {
+ foreach (const PropertyName &propertyName, qmlObjectNode.modelNode().metaInfo().propertyNames())
+ createPropertyEditorValue(qmlObjectNode, propertyName, qmlObjectNode.instanceValue(propertyName), propertyEditor);
+
+ // className
+ PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value("className")));
+ if (!valueObject)
+ valueObject = new PropertyEditorValue(&m_backendValuesPropertyMap);
+ valueObject->setName("className");
+ valueObject->setModelNode(qmlObjectNode.modelNode());
+ valueObject->setValue(qmlObjectNode.modelNode().simplifiedTypeName());
+ QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), &m_backendValuesPropertyMap, SIGNAL(valueChanged(QString,QVariant)));
+ m_backendValuesPropertyMap.insert("className", QVariant::fromValue(valueObject));
+
+ // id
+ valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value("id")));
+ if (!valueObject)
+ valueObject = new PropertyEditorValue(&m_backendValuesPropertyMap);
+ valueObject->setName("id");
+ valueObject->setValue(qmlObjectNode.id());
+ QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), &m_backendValuesPropertyMap, SIGNAL(valueChanged(QString,QVariant)));
+ m_backendValuesPropertyMap.insert("id", QVariant::fromValue(valueObject));
+
+ // anchors
+ m_backendAnchorBinding.setup(QmlItemNode(qmlObjectNode.modelNode()));
+
+ ctxt->setContextProperty("anchorBackend", &m_backendAnchorBinding);
+
+ ctxt->setContextProperty("transaction", m_propertyEditorTransaction.data());
+
+ contextObject()->setSpecificsUrl(qmlSpecificsFile);
+
+ contextObject()->setStateName(stateName);
+ if (!qmlObjectNode.isValid())
+ return;
+ ctxt->setContextProperty("propertyCount", QVariant(qmlObjectNode.modelNode().properties().count()));
+
+ contextObject()->setIsBaseState(qmlObjectNode.isInBaseState());
+ contextObject()->setSelectionChanged(false);
+
+ contextObject()->setSelectionChanged(false);
+
+ NodeMetaInfo metaInfo = qmlObjectNode.modelNode().metaInfo();
+
+ if (metaInfo.isValid()) {
+ contextObject()->setMajorVersion(metaInfo.majorVersion());
+ contextObject()->setMinorVersion(metaInfo.minorVersion());
+ } else {
+ contextObject()->setMajorVersion(-1);
+ contextObject()->setMinorVersion(-1);
+ }
+
+ } else {
+ qWarning() << "PropertyEditor: invalid node for setup";
+ }
+}
+
+void PropertyEditorQmlBackend::initialSetup(const TypeName &typeName, const QUrl &qmlSpecificsFile, PropertyEditorView *propertyEditor)
+{
+ QDeclarativeContext *ctxt = m_view->rootContext();
+
+ NodeMetaInfo metaInfo = propertyEditor->model()->metaInfo(typeName, 4, 7);
+
+ foreach (const PropertyName &propertyName, metaInfo.propertyNames())
+ setupPropertyEditorValue(propertyName, propertyEditor, metaInfo.propertyTypeName(propertyName));
+
+ PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value("className")));
+ if (!valueObject)
+ valueObject = new PropertyEditorValue(&m_backendValuesPropertyMap);
+ valueObject->setName("className");
+
+ valueObject->setValue(typeName);
+ QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), &m_backendValuesPropertyMap, SIGNAL(valueChanged(QString,QVariant)));
+ m_backendValuesPropertyMap.insert("className", QVariant::fromValue(valueObject));
+
+ // id
+ valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value("id")));
+ if (!valueObject)
+ valueObject = new PropertyEditorValue(&m_backendValuesPropertyMap);
+ valueObject->setName("id");
+ valueObject->setValue("id");
+ QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), &m_backendValuesPropertyMap, SIGNAL(valueChanged(QString,QVariant)));
+ m_backendValuesPropertyMap.insert("id", QVariant::fromValue(valueObject));
+
+ ctxt->setContextProperty("anchorBackend", &m_backendAnchorBinding);
+ ctxt->setContextProperty("transaction", m_propertyEditorTransaction.data());
+
+ contextObject()->setSpecificsUrl(qmlSpecificsFile);
+
+ contextObject()->setStateName(QLatin1String("basestate"));
+
+ contextObject()->setIsBaseState(true);
+
+ contextObject()->setSpecificQmlData(QLatin1String(""));
+
+ contextObject()->setGlobalBaseUrl(QUrl());
+}
+
+QString PropertyEditorQmlBackend::propertyEditorResourcesPath() {
+ return sharedDirPath() + QLatin1String("/propertyeditor");
+}
+
+} //QmlDesigner
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h
new file mode 100644
index 0000000000..97a78bf70c
--- /dev/null
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef PROPERTYEDITORQMLBACKEND_H
+#define PROPERTYEDITORQMLBACKEND_H
+
+#include "qmlanchorbindingproxy.h"
+#include "designerpropertymap.h"
+#include "propertyeditorvalue.h"
+#include "propertyeditorcontextobject.h"
+#include "quickpropertyeditorview.h"
+
+class PropertyEditorValue;
+
+namespace QmlDesigner {
+
+class PropertyEditorTransaction;
+class PropertyEditorView;
+
+class PropertyEditorQmlBackend {
+public:
+ PropertyEditorQmlBackend(PropertyEditorView *propertyEditor);
+ ~PropertyEditorQmlBackend();
+
+ void setup(const QmlObjectNode &fxObjectNode, const QString &stateName, const QUrl &qmlSpecificsFile, PropertyEditorView *propertyEditor);
+ void initialSetup(const TypeName &typeName, const QUrl &qmlSpecificsFile, PropertyEditorView *propertyEditor);
+ void setValue(const QmlObjectNode &fxObjectNode, const PropertyName &name, const QVariant &value);
+
+ QDeclarativeContext *context();
+ PropertyEditorContextObject* contextObject();
+ QWidget *widget();
+ void setSource(const QUrl& url);
+ Internal::QmlAnchorBindingProxy &backendAnchorBinding();
+ DesignerPropertyMap<PropertyEditorValue> &backendValuesPropertyMap();
+ PropertyEditorTransaction *propertyEditorTransaction();
+
+ PropertyEditorValue *propertyValueForName(const QString &propertyName);
+
+ static QString propertyEditorResourcesPath();
+
+private:
+ void createPropertyEditorValue(const QmlObjectNode &qmlObjectNode,
+ const PropertyName &name, const QVariant &value,
+ PropertyEditorView *propertyEditor);
+ void setupPropertyEditorValue(const PropertyName &name, PropertyEditorView *propertyEditor, const QString &type);
+
+private:
+ QuickPropertyEditorView *m_view;
+ Internal::QmlAnchorBindingProxy m_backendAnchorBinding;
+ DesignerPropertyMap<PropertyEditorValue> m_backendValuesPropertyMap;
+ QScopedPointer<PropertyEditorTransaction> m_propertyEditorTransaction;
+ QScopedPointer<PropertyEditorValue> m_dummyPropertyEditorValue;
+ QScopedPointer<PropertyEditorContextObject> m_contextObject;
+};
+
+} //QmlDesigner
+
+#endif //PROPERTYEDITORQMLBACKEND_H
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.cpp
index 6b5b32c950..11ebf55777 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.cpp
@@ -34,7 +34,7 @@
namespace QmlDesigner {
-PropertyEditorTransaction::PropertyEditorTransaction(QmlDesigner::PropertyEditor *propertyEditor) : QObject(propertyEditor), m_propertyEditor(propertyEditor), m_timerId(-1)
+PropertyEditorTransaction::PropertyEditorTransaction(QmlDesigner::PropertyEditorView *propertyEditor) : QObject(propertyEditor), m_propertyEditor(propertyEditor), m_timerId(-1)
{
}
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.h
index ef54a8f810..5eb8c1d3cf 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.h
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.h
@@ -30,7 +30,7 @@
#ifndef PROPERTYEDITORTRANSACTION_H
#define PROPERTYEDITORTRANSACTION_H
-#include "propertyeditor.h"
+#include "propertyeditorview.h"
namespace QmlDesigner {
@@ -38,7 +38,7 @@ class PropertyEditorTransaction : public QObject
{
Q_OBJECT
public:
- PropertyEditorTransaction(QmlDesigner::PropertyEditor *propertyEditor);
+ PropertyEditorTransaction(QmlDesigner::PropertyEditorView *propertyEditor);
public slots:
void start();
@@ -47,7 +47,7 @@ protected:
void timerEvent(QTimerEvent *event);
private:
- QmlDesigner::PropertyEditor *m_propertyEditor;
+ QmlDesigner::PropertyEditorView *m_propertyEditor;
QmlDesigner::RewriterTransaction m_rewriterTransaction;
int m_timerId;
};
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp
index 10b6453606..4260ddafdf 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp
@@ -27,7 +27,7 @@
**
****************************************************************************/
-#include "propertyeditor.h"
+#include "propertyeditorview.h"
#include <qmldesignerconstants.h>
@@ -64,59 +64,22 @@
#include <QFileInfo>
#include <QDebug>
#include <QTimer>
-#include <QDeclarativeContext>
#include <QShortcut>
#include <QMessageBox>
#include <QApplication>
-#ifdef Q_OS_WIN
-#include <utils/winutils.h>
-#endif
-
enum {
debug = false
};
const int collapseButtonOffset = 114;
-
-namespace QmlDesigner {
-
const char resourcePropertyEditorPath[] = ":/propertyeditor";
-static QString applicationDirPath()
-{
-#ifdef Q_OS_WIN
- // normalize paths so QML doesn't freak out if it's wrongly capitalized on Windows
- return Utils::normalizePathName(QCoreApplication::applicationDirPath());
-#else
- return QCoreApplication::applicationDirPath();
-#endif
-}
-
-#ifdef Q_OS_MAC
-# define SHARE_PATH "/../Resources/qmldesigner"
-#else
-# define SHARE_PATH "/../share/qtcreator/qmldesigner"
-#endif
-
-static inline QString sharedDirPath()
-{
- QString appPath = applicationDirPath();
-
- return QFileInfo(appPath + SHARE_PATH).absoluteFilePath();
-}
+namespace QmlDesigner {
static inline QString propertyTemplatesPath()
{
- return sharedDirPath() + QLatin1String("/propertyeditor/PropertyTemplates/");
-}
-
-static QObject *variantToQObject(const QVariant &v)
-{
- if (v.userType() == QMetaType::QObjectStar || v.userType() > QMetaType::User)
- return *(QObject **)v.constData();
-
- return 0;
+ return PropertyEditorQmlBackend::propertyEditorResourcesPath() + QLatin1String("/PropertyTemplates/");
}
static QmlJS::SimpleReaderNode::Ptr s_templateConfiguration;
@@ -144,200 +107,68 @@ QStringList variantToStringList(const QVariant &variant) {
return stringList;
}
-PropertyEditor::NodeType::NodeType(PropertyEditor *propertyEditor) :
- m_view(new DeclarativeWidgetView), m_propertyEditorTransaction(new PropertyEditorTransaction(propertyEditor)), m_dummyPropertyEditorValue(new PropertyEditorValue()),
- m_contextObject(new PropertyEditorContextObject())
-{
- Q_ASSERT(QFileInfo(":/images/button_normal.png").exists());
-
- QDeclarativeContext *ctxt = m_view->rootContext();
- m_view->engine()->setOutputWarningsToStandardError(debug);
- m_view->engine()->addImportPath(sharedDirPath() + QLatin1String("/propertyeditor"));
- m_dummyPropertyEditorValue->setValue("#000000");
- ctxt->setContextProperty("dummyBackendValue", m_dummyPropertyEditorValue.data());
- m_contextObject->setBackendValues(&m_backendValuesPropertyMap);
- ctxt->setContextObject(m_contextObject.data());
-
- connect(&m_backendValuesPropertyMap, SIGNAL(valueChanged(QString,QVariant)), propertyEditor, SLOT(changeValue(QString)));
-}
-
-PropertyEditor::NodeType::~NodeType()
-{
-}
-
-void setupPropertyEditorValue(const PropertyName &name, QDeclarativePropertyMap *propertyMap, PropertyEditor *propertyEditor, const QString &type)
-{
- QmlDesigner::PropertyName propertyName(name);
- propertyName.replace('.', '_');
- PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(propertyMap->value(propertyName)));
- if (!valueObject) {
- valueObject = new PropertyEditorValue(propertyMap);
- QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), propertyMap, SIGNAL(valueChanged(QString,QVariant)));
- QObject::connect(valueObject, SIGNAL(expressionChanged(QString)), propertyEditor, SLOT(changeExpression(QString)));
- propertyMap->insert(QString::fromUtf8(propertyName), QVariant::fromValue(valueObject));
- }
- valueObject->setName(propertyName);
- if (type == "QColor")
- valueObject->setValue(QVariant("#000000"));
- else
- valueObject->setValue(QVariant(1));
-
-}
-
-void createPropertyEditorValue(const QmlObjectNode &qmlObjectNode, const PropertyName &name, const QVariant &value, QDeclarativePropertyMap *propertyMap, PropertyEditor *propertyEditor)
-{
- PropertyName propertyName(name);
- propertyName.replace('.', '_');
- PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(propertyMap->value(propertyName)));
- if (!valueObject) {
- valueObject = new PropertyEditorValue(propertyMap);
- QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), propertyMap, SIGNAL(valueChanged(QString,QVariant)));
- QObject::connect(valueObject, SIGNAL(expressionChanged(QString)), propertyEditor, SLOT(changeExpression(QString)));
- propertyMap->insert(QString::fromUtf8(propertyName), QVariant::fromValue(valueObject));
- }
- valueObject->setName(name);
- valueObject->setModelNode(qmlObjectNode);
-
- if (qmlObjectNode.propertyAffectedByCurrentState(name) && !(qmlObjectNode.modelNode().property(name).isBindingProperty()))
- valueObject->setValue(qmlObjectNode.modelValue(name));
-
- else
- valueObject->setValue(value);
-
- if (propertyName != "id" &&
- qmlObjectNode.currentState().isBaseState() &&
- qmlObjectNode.modelNode().property(propertyName).isBindingProperty()) {
- valueObject->setExpression(qmlObjectNode.modelNode().bindingProperty(propertyName).expression());
- } else {
- valueObject->setExpression(qmlObjectNode.instanceValue(name).toString());
- }
-}
-
-void PropertyEditor::NodeType::setValue(const QmlObjectNode & qmlObjectNode, const PropertyName &name, const QVariant &value)
-{
- PropertyName propertyName = name;
- propertyName.replace('.', '_');
- PropertyEditorValue *propertyValue = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value(propertyName)));
- if (propertyValue) {
- propertyValue->setValue(value);
- if (!qmlObjectNode.hasBindingProperty(name))
- propertyValue->setExpression(value.toString());
- else
- propertyValue->setExpression(qmlObjectNode.expression(name));
- }
-}
-
-void PropertyEditor::NodeType::setup(const QmlObjectNode &qmlObjectNode, const QString &stateName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor)
+QString templateGeneration(NodeMetaInfo type, NodeMetaInfo superType, const QmlObjectNode &objectNode)
{
- if (!qmlObjectNode.isValid())
- return;
-
- QDeclarativeContext *ctxt = m_view->rootContext();
-
- if (qmlObjectNode.isValid()) {
- foreach (const PropertyName &propertyName, qmlObjectNode.modelNode().metaInfo().propertyNames())
- createPropertyEditorValue(qmlObjectNode, propertyName, qmlObjectNode.instanceValue(propertyName), &m_backendValuesPropertyMap, propertyEditor);
-
- // className
- PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value("className")));
- if (!valueObject)
- valueObject = new PropertyEditorValue(&m_backendValuesPropertyMap);
- valueObject->setName("className");
- valueObject->setModelNode(qmlObjectNode.modelNode());
- valueObject->setValue(qmlObjectNode.modelNode().simplifiedTypeName());
- QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), &m_backendValuesPropertyMap, SIGNAL(valueChanged(QString,QVariant)));
- m_backendValuesPropertyMap.insert("className", QVariant::fromValue(valueObject));
-
- // id
- valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value("id")));
- if (!valueObject)
- valueObject = new PropertyEditorValue(&m_backendValuesPropertyMap);
- valueObject->setName("id");
- valueObject->setValue(qmlObjectNode.id());
- QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), &m_backendValuesPropertyMap, SIGNAL(valueChanged(QString,QVariant)));
- m_backendValuesPropertyMap.insert("id", QVariant::fromValue(valueObject));
+ if (!templateConfiguration() && templateConfiguration()->isValid())
+ return QString();
- // anchors
- m_backendAnchorBinding.setup(QmlItemNode(qmlObjectNode.modelNode()));
+ QStringList imports = variantToStringList(templateConfiguration()->property(QLatin1String("imports")));
- ctxt->setContextProperty("anchorBackend", &m_backendAnchorBinding);
+ QString qmlTemplate = imports.join(QLatin1String("\n")) + QLatin1Char('\n');
+ qmlTemplate += QLatin1String("GroupBox {\n");
+ qmlTemplate += QString(QLatin1String("caption: \"%1\"\n")).arg(QString::fromUtf8(objectNode.modelNode().simplifiedTypeName()));
+ qmlTemplate += QLatin1String("layout: VerticalLayout {\n");
- ctxt->setContextProperty("transaction", m_propertyEditorTransaction.data());
+ QList<PropertyName> orderedList = type.propertyNames();
+ qSort(orderedList);
- m_contextObject->setSpecificsUrl(qmlSpecificsFile);
+ bool emptyTemplate = true;
- m_contextObject->setStateName(stateName);
- if (!qmlObjectNode.isValid())
- return;
- ctxt->setContextProperty("propertyCount", QVariant(qmlObjectNode.modelNode().properties().count()));
+ foreach (const PropertyName &name, orderedList) {
- m_contextObject->setIsBaseState(qmlObjectNode.isInBaseState());
- m_contextObject->setSelectionChanged(false);
+ if (name.startsWith("__"))
+ continue; //private API
+ PropertyName properName = name;
- m_contextObject->setSelectionChanged(false);
+ properName.replace('.', '_');
- NodeMetaInfo metaInfo = qmlObjectNode.modelNode().metaInfo();
+ QString typeName = type.propertyTypeName(name);
+ //alias resolution only possible with instance
+ if (typeName == QLatin1String("alias") && objectNode.isValid())
+ typeName = objectNode.instanceType(name);
- if (metaInfo.isValid()) {
- m_contextObject->setMajorVersion(metaInfo.majorVersion());
- m_contextObject->setMinorVersion(metaInfo.minorVersion());
- } else {
- m_contextObject->setMajorVersion(-1);
- m_contextObject->setMinorVersion(-1);
+ if (!superType.hasProperty(name) && type.propertyIsWritable(name) && !name.contains(".")) {
+ foreach (const QmlJS::SimpleReaderNode::Ptr &node, templateConfiguration()->children())
+ if (variantToStringList(node->property(QLatin1String("typeNames"))).contains(typeName)) {
+ const QString fileName = propertyTemplatesPath() + node->property(QLatin1String("sourceFile")).toString();
+ QFile file(fileName);
+ if (file.open(QIODevice::ReadOnly)) {
+ QString source = file.readAll();
+ file.close();
+ qmlTemplate += source.arg(QString::fromUtf8(name)).arg(QString::fromUtf8(properName));
+ emptyTemplate = false;
+ } else {
+ qWarning().nospace() << "template definition source file not found:" << fileName;
+ }
+ }
}
-
- } else {
- qWarning() << "PropertyEditor: invalid node for setup";
}
-}
-
-void PropertyEditor::NodeType::initialSetup(const TypeName &typeName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor)
-{
- QDeclarativeContext *ctxt = m_view->rootContext();
-
- NodeMetaInfo metaInfo = propertyEditor->model()->metaInfo(typeName, 4, 7);
-
- foreach (const PropertyName &propertyName, metaInfo.propertyNames())
- setupPropertyEditorValue(propertyName, &m_backendValuesPropertyMap, propertyEditor, metaInfo.propertyTypeName(propertyName));
-
- PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value("className")));
- if (!valueObject)
- valueObject = new PropertyEditorValue(&m_backendValuesPropertyMap);
- valueObject->setName("className");
-
- valueObject->setValue(typeName);
- QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), &m_backendValuesPropertyMap, SIGNAL(valueChanged(QString,QVariant)));
- m_backendValuesPropertyMap.insert("className", QVariant::fromValue(valueObject));
-
- // id
- valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value("id")));
- if (!valueObject)
- valueObject = new PropertyEditorValue(&m_backendValuesPropertyMap);
- valueObject->setName("id");
- valueObject->setValue("id");
- QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), &m_backendValuesPropertyMap, SIGNAL(valueChanged(QString,QVariant)));
- m_backendValuesPropertyMap.insert("id", QVariant::fromValue(valueObject));
-
- ctxt->setContextProperty("anchorBackend", &m_backendAnchorBinding);
- ctxt->setContextProperty("transaction", m_propertyEditorTransaction.data());
-
- m_contextObject->setSpecificsUrl(qmlSpecificsFile);
-
- m_contextObject->setStateName(QLatin1String("basestate"));
-
- m_contextObject->setIsBaseState(true);
+ qmlTemplate += QLatin1String("}\n"); //VerticalLayout
+ qmlTemplate += QLatin1String("}\n"); //GroupBox
- m_contextObject->setSpecificQmlData(QLatin1String(""));
+ if (emptyTemplate)
+ return QString();
- m_contextObject->setGlobalBaseUrl(QUrl());
+ return qmlTemplate;
}
-PropertyEditor::PropertyEditor(QWidget *parent) :
+
+PropertyEditorView::PropertyEditorView(QWidget *parent) :
AbstractView(parent),
m_parent(parent),
m_updateShortcut(0),
m_timerId(0),
- m_stackedWidget(new StackedWidget(parent)),
+ m_stackedWidget(new PropertyEditorWidget(parent)),
m_currentType(0),
m_locked(false),
m_setupCompleted(false),
@@ -370,11 +201,11 @@ PropertyEditor::PropertyEditor(QWidget *parent) :
OriginWidget::registerDeclarativeType();
GradientLineQmlAdaptor::registerDeclarativeType();
}
- setQmlDir(sharedDirPath() + QLatin1String("/propertyeditor"));
+ setQmlDir(PropertyEditorQmlBackend::propertyEditorResourcesPath());
m_stackedWidget->setWindowTitle(tr("Properties"));
}
-PropertyEditor::~PropertyEditor()
+PropertyEditorView::~PropertyEditorView()
{
qDeleteAll(m_typeHash);
}
@@ -386,7 +217,7 @@ static inline QString fixTypeNameForPanes(const QString &typeName)
return fixedTypeName;
}
-void PropertyEditor::setupPane(const TypeName &typeName)
+void PropertyEditorView::setupPane(const TypeName &typeName)
{
NodeMetaInfo metaInfo = model()->metaInfo(typeName);
@@ -394,29 +225,27 @@ void PropertyEditor::setupPane(const TypeName &typeName)
QUrl qmlSpecificsFile;
qmlSpecificsFile = fileToUrl(locateQmlFile(metaInfo, fixTypeNameForPanes(typeName) + "Specifics.qml"));
- NodeType *type = m_typeHash.value(qmlFile.toString());
+ PropertyEditorQmlBackend *type = m_typeHash.value(qmlFile.toString());
if (!type) {
- type = new NodeType(this);
+ type = new PropertyEditorQmlBackend(this);
- QDeclarativeContext *ctxt = type->m_view->rootContext();
- ctxt->setContextProperty("finishedNotify", QVariant(false) );
+ type->context()->setContextProperty("finishedNotify", QVariant(false) );
type->initialSetup(typeName, qmlSpecificsFile, this);
- type->m_view->setSource(qmlFile);
- ctxt->setContextProperty("finishedNotify", QVariant(true) );
+ type->setSource(qmlFile);
+ type->context()->setContextProperty("finishedNotify", QVariant(true) );
- m_stackedWidget->addWidget(type->m_view);
+ m_stackedWidget->addWidget(type->widget());
m_typeHash.insert(qmlFile.toString(), type);
} else {
- QDeclarativeContext *ctxt = type->m_view->rootContext();
- ctxt->setContextProperty("finishedNotify", QVariant(false) );
+ type->context()->setContextProperty("finishedNotify", QVariant(false) );
type->initialSetup(typeName, qmlSpecificsFile, this);
- ctxt->setContextProperty("finishedNotify", QVariant(true) );
+ type->context()->setContextProperty("finishedNotify", QVariant(true) );
}
}
-void PropertyEditor::changeValue(const QString &name)
+void PropertyEditorView::changeValue(const QString &name)
{
PropertyName propertyName = name.toUtf8();
@@ -433,7 +262,7 @@ void PropertyEditor::changeValue(const QString &name)
return;
if (propertyName == "id") {
- PropertyEditorValue *value = qobject_cast<PropertyEditorValue*>(variantToQObject(m_currentType->m_backendValuesPropertyMap.value(propertyName)));
+ PropertyEditorValue *value = m_currentType->propertyValueForName(propertyName);
const QString newId = value->value().toString();
if (newId == m_selectedNode.id())
@@ -468,7 +297,7 @@ void PropertyEditor::changeValue(const QString &name)
//.replace(QLatin1Char('.'), QLatin1Char('_'))
PropertyName underscoreName(propertyName);
underscoreName.replace('.', '_');
- PropertyEditorValue *value = qobject_cast<PropertyEditorValue*>(variantToQObject(m_currentType->m_backendValuesPropertyMap.value(underscoreName)));
+ PropertyEditorValue *value = m_currentType->propertyValueForName(underscoreName);
if (value ==0)
return;
@@ -522,7 +351,7 @@ void PropertyEditor::changeValue(const QString &name)
}
}
-void PropertyEditor::changeExpression(const QString &propertyName)
+void PropertyEditorView::changeExpression(const QString &propertyName)
{
PropertyName name = propertyName.toUtf8();
@@ -539,7 +368,7 @@ void PropertyEditor::changeExpression(const QString &propertyName)
underscoreName.replace('.', '_');
QmlObjectNode qmlObjectNode(m_selectedNode);
- PropertyEditorValue *value = qobject_cast<PropertyEditorValue*>(variantToQObject(m_currentType->m_backendValuesPropertyMap.value(underscoreName)));
+ PropertyEditorValue *value = m_currentType->propertyValueForName(underscoreName);
if (qmlObjectNode.modelNode().metaInfo().isValid() && qmlObjectNode.modelNode().metaInfo().hasProperty(name)) {
if (qmlObjectNode.modelNode().metaInfo().propertyTypeName(name) == "QColor") {
@@ -595,16 +424,16 @@ void PropertyEditor::changeExpression(const QString &propertyName)
}
}
-void PropertyEditor::updateSize()
+void PropertyEditorView::updateSize()
{
if (!m_currentType)
return;
- QWidget* frame = m_currentType->m_view->findChild<QWidget*>("propertyEditorFrame");
+ QWidget* frame = m_currentType->widget()->findChild<QWidget*>("propertyEditorFrame");
if (frame)
frame->resize(m_stackedWidget->size());
}
-void PropertyEditor::setupPanes()
+void PropertyEditorView::setupPanes()
{
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
setupPane("QtQuick.Rectangle");
@@ -614,7 +443,7 @@ void PropertyEditor::setupPanes()
QApplication::restoreOverrideCursor();
}
-void PropertyEditor::setQmlDir(const QString &qmlDir)
+void PropertyEditorView::setQmlDir(const QString &qmlDir)
{
m_qmlDir = qmlDir;
@@ -624,74 +453,19 @@ void PropertyEditor::setQmlDir(const QString &qmlDir)
connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(reloadQml()));
}
-void PropertyEditor::delayedResetView()
+void PropertyEditorView::delayedResetView()
{
if (m_timerId == 0)
m_timerId = startTimer(100);
}
-void PropertyEditor::timerEvent(QTimerEvent *timerEvent)
+void PropertyEditorView::timerEvent(QTimerEvent *timerEvent)
{
if (m_timerId == timerEvent->timerId())
resetView();
}
-QString templateGeneration(NodeMetaInfo type, NodeMetaInfo superType, const QmlObjectNode &objectNode)
-{
- if (!templateConfiguration() && templateConfiguration()->isValid())
- return QString();
-
- QStringList imports = variantToStringList(templateConfiguration()->property(QLatin1String("imports")));
-
- QString qmlTemplate = imports.join(QLatin1String("\n")) + QLatin1Char('\n');
- qmlTemplate += QLatin1String("GroupBox {\n");
- qmlTemplate += QString(QLatin1String("caption: \"%1\"\n")).arg(QString::fromUtf8(objectNode.modelNode().simplifiedTypeName()));
- qmlTemplate += QLatin1String("layout: VerticalLayout {\n");
-
- QList<PropertyName> orderedList = type.propertyNames();
- qSort(orderedList);
-
- bool emptyTemplate = true;
-
- foreach (const PropertyName &name, orderedList) {
-
- if (name.startsWith("__"))
- continue; //private API
- PropertyName properName = name;
-
- properName.replace('.', '_');
-
- QString typeName = type.propertyTypeName(name);
- //alias resolution only possible with instance
- if (typeName == QLatin1String("alias") && objectNode.isValid())
- typeName = objectNode.instanceType(name);
-
- if (!superType.hasProperty(name) && type.propertyIsWritable(name) && !name.contains(".")) {
- foreach (const QmlJS::SimpleReaderNode::Ptr &node, templateConfiguration()->children())
- if (variantToStringList(node->property(QLatin1String("typeNames"))).contains(typeName)) {
- const QString fileName = propertyTemplatesPath() + node->property(QLatin1String("sourceFile")).toString();
- QFile file(fileName);
- if (file.open(QIODevice::ReadOnly)) {
- QString source = file.readAll();
- file.close();
- qmlTemplate += source.arg(QString::fromUtf8(name)).arg(QString::fromUtf8(properName));
- emptyTemplate = false;
- } else {
- qWarning().nospace() << "template definition source file not found:" << fileName;
- }
- }
- }
- }
- qmlTemplate += QLatin1String("}\n"); //VerticalLayout
- qmlTemplate += QLatin1String("}\n"); //GroupBox
-
- if (emptyTemplate)
- return QString();
-
- return qmlTemplate;
-}
-
-void PropertyEditor::resetView()
+void PropertyEditorView::resetView()
{
if (model() == 0)
return;
@@ -736,14 +510,14 @@ void PropertyEditor::resetView()
specificQmlData = templateGeneration(m_selectedNode.metaInfo(), model()->metaInfo(diffClassName), m_selectedNode);
}
- NodeType *type = m_typeHash.value(qmlFile.toString());
+ PropertyEditorQmlBackend *type = m_typeHash.value(qmlFile.toString());
QString currentStateName = currentState().isBaseState() ? currentState().name() : QLatin1String("invalid state");
if (!type) {
- type = new NodeType(this);
+ type = new PropertyEditorQmlBackend(this);
- m_stackedWidget->addWidget(type->m_view);
+ m_stackedWidget->addWidget(type->widget());
m_typeHash.insert(qmlFile.toString(), type);
QmlObjectNode qmlObjectNode;
@@ -751,39 +525,35 @@ void PropertyEditor::resetView()
qmlObjectNode = QmlObjectNode(m_selectedNode);
Q_ASSERT(qmlObjectNode.isValid());
}
- QDeclarativeContext *ctxt = type->m_view->rootContext();
type->setup(qmlObjectNode, currentStateName, qmlSpecificsFile, this);
- ctxt->setContextProperty("finishedNotify", QVariant(false));
+ type->context()->setContextProperty("finishedNotify", QVariant(false));
if (specificQmlData.isEmpty())
- type->m_contextObject->setSpecificQmlData(specificQmlData);
+ type->contextObject()->setSpecificQmlData(specificQmlData);
- type->m_contextObject->setGlobalBaseUrl(qmlFile);
- type->m_contextObject->setSpecificQmlData(specificQmlData);
- type->m_view->setSource(qmlFile);
- ctxt->setContextProperty("finishedNotify", QVariant(true));
+ type->contextObject()->setGlobalBaseUrl(qmlFile);
+ type->contextObject()->setSpecificQmlData(specificQmlData);
+ type->setSource(qmlFile);
+ type->context()->setContextProperty("finishedNotify", QVariant(true));
} else {
QmlObjectNode qmlObjectNode;
if (m_selectedNode.isValid())
qmlObjectNode = QmlObjectNode(m_selectedNode);
- QDeclarativeContext *ctxt = type->m_view->rootContext();
- ctxt->setContextProperty("finishedNotify", QVariant(false));
+ type->context()->setContextProperty("finishedNotify", QVariant(false));
if (specificQmlData.isEmpty())
- type->m_contextObject->setSpecificQmlData(specificQmlData);
+ type->contextObject()->setSpecificQmlData(specificQmlData);
type->setup(qmlObjectNode, currentStateName, qmlSpecificsFile, this);
- type->m_contextObject->setGlobalBaseUrl(qmlFile);
- type->m_contextObject->setSpecificQmlData(specificQmlData);
+ type->contextObject()->setGlobalBaseUrl(qmlFile);
+ type->contextObject()->setSpecificQmlData(specificQmlData);
}
- m_stackedWidget->setCurrentWidget(type->m_view);
+ m_stackedWidget->setCurrentWidget(type->widget());
-
- QDeclarativeContext *ctxt = type->m_view->rootContext();
- ctxt->setContextProperty("finishedNotify", QVariant(true));
+ type->context()->setContextProperty("finishedNotify", QVariant(true));
/*ctxt->setContextProperty("selectionChanged", QVariant(false));
ctxt->setContextProperty("selectionChanged", QVariant(true));
ctxt->setContextProperty("selectionChanged", QVariant(false));*/
- type->m_contextObject->triggerSelectionChanged();
+ type->contextObject()->triggerSelectionChanged();
m_currentType = type;
@@ -795,7 +565,7 @@ void PropertyEditor::resetView()
updateSize();
}
-void PropertyEditor::selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
+void PropertyEditorView::selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
const QList<ModelNode> &lastSelectedNodeList)
{
Q_UNUSED(lastSelectedNodeList);
@@ -806,13 +576,13 @@ void PropertyEditor::selectedNodesChanged(const QList<ModelNode> &selectedNodeLi
select(selectedNodeList.first());
}
-void PropertyEditor::nodeAboutToBeRemoved(const ModelNode &removedNode)
+void PropertyEditorView::nodeAboutToBeRemoved(const ModelNode &removedNode)
{
if (m_selectedNode.isValid() && removedNode.isValid() && m_selectedNode == removedNode)
select(m_selectedNode.parentProperty().parentModelNode());
}
-void PropertyEditor::modelAttached(Model *model)
+void PropertyEditorView::modelAttached(Model *model)
{
AbstractView::modelAttached(model);
@@ -832,16 +602,15 @@ void PropertyEditor::modelAttached(Model *model)
m_locked = false;
}
-void PropertyEditor::modelAboutToBeDetached(Model *model)
+void PropertyEditorView::modelAboutToBeDetached(Model *model)
{
AbstractView::modelAboutToBeDetached(model);
- m_currentType->m_propertyEditorTransaction->end();
+ m_currentType->propertyEditorTransaction()->end();
resetView();
}
-
-void PropertyEditor::propertiesRemoved(const QList<AbstractProperty>& propertyList)
+void PropertyEditorView::propertiesRemoved(const QList<AbstractProperty>& propertyList)
{
if (!m_selectedNode.isValid())
return;
@@ -854,13 +623,12 @@ void PropertyEditor::propertiesRemoved(const QList<AbstractProperty>& propertyLi
if (node == m_selectedNode || QmlObjectNode(m_selectedNode).propertyChangeForCurrentState() == node) {
setValue(m_selectedNode, property.name(), QmlObjectNode(m_selectedNode).instanceValue(property.name()));
if (property.name().contains("anchor"))
- m_currentType->m_backendAnchorBinding.invalidate(m_selectedNode);
+ m_currentType->backendAnchorBinding().invalidate(m_selectedNode);
}
}
}
-
-void PropertyEditor::variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags /*propertyChange*/)
+void PropertyEditorView::variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags /*propertyChange*/)
{
if (!m_selectedNode.isValid())
@@ -881,7 +649,7 @@ void PropertyEditor::variantPropertiesChanged(const QList<VariantProperty>& prop
}
}
-void PropertyEditor::bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags /*propertyChange*/)
+void PropertyEditorView::bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags /*propertyChange*/)
{
if (!m_selectedNode.isValid())
return;
@@ -894,7 +662,7 @@ void PropertyEditor::bindingPropertiesChanged(const QList<BindingProperty>& prop
if (node == m_selectedNode || QmlObjectNode(m_selectedNode).propertyChangeForCurrentState() == node) {
if (property.name().contains("anchor"))
- m_currentType->m_backendAnchorBinding.invalidate(m_selectedNode);
+ m_currentType->backendAnchorBinding().invalidate(m_selectedNode);
if ( QmlObjectNode(m_selectedNode).modelNode().property(property.name()).isBindingProperty())
setValue(m_selectedNode, property.name(), QmlObjectNode(m_selectedNode).instanceValue(property.name()));
else
@@ -903,13 +671,12 @@ void PropertyEditor::bindingPropertiesChanged(const QList<BindingProperty>& prop
}
}
-void PropertyEditor::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> & /*propertyList*/,
+void PropertyEditorView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> & /*propertyList*/,
AbstractView::PropertyChangeFlags /*propertyChange*/)
{
}
-
-void PropertyEditor::instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash)
+void PropertyEditorView::instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash)
{
if (!m_selectedNode.isValid())
return;
@@ -918,11 +685,11 @@ void PropertyEditor::instanceInformationsChange(const QMultiHash<ModelNode, Info
QList<InformationName> informationNameList = informationChangeHash.values(m_selectedNode);
if (informationNameList.contains(Anchor)
|| informationNameList.contains(HasAnchor))
- m_currentType->m_backendAnchorBinding.setup(QmlItemNode(m_selectedNode));
+ m_currentType->backendAnchorBinding().setup(QmlItemNode(m_selectedNode));
m_locked = false;
}
-void PropertyEditor::nodeIdChanged(const ModelNode& node, const QString& newId, const QString& /*oldId*/)
+void PropertyEditorView::nodeIdChanged(const ModelNode& node, const QString& newId, const QString& /*oldId*/)
{
if (!m_selectedNode.isValid())
return;
@@ -937,11 +704,11 @@ void PropertyEditor::nodeIdChanged(const ModelNode& node, const QString& newId,
}
}
-void PropertyEditor::scriptFunctionsChanged(const ModelNode &/*node*/, const QStringList &/*scriptFunctionList*/)
+void PropertyEditorView::scriptFunctionsChanged(const ModelNode &/*node*/, const QStringList &/*scriptFunctionList*/)
{
}
-void PropertyEditor::select(const ModelNode &node)
+void PropertyEditorView::select(const ModelNode &node)
{
if (QmlObjectNode(node).isValid())
m_selectedNode = node;
@@ -951,17 +718,17 @@ void PropertyEditor::select(const ModelNode &node)
delayedResetView();
}
-bool PropertyEditor::hasWidget() const
+bool PropertyEditorView::hasWidget() const
{
return true;
}
-WidgetInfo PropertyEditor::widgetInfo()
+WidgetInfo PropertyEditorView::widgetInfo()
{
return createWidgetInfo(m_stackedWidget, 0, QLatin1String("Properties"), WidgetInfo::RightPane, 0);
}
-void PropertyEditor::currentStateChanged(const ModelNode &node)
+void PropertyEditorView::currentStateChanged(const ModelNode &node)
{
QmlModelState newQmlModelState(node);
Q_ASSERT(newQmlModelState.isValid());
@@ -970,7 +737,7 @@ void PropertyEditor::currentStateChanged(const ModelNode &node)
delayedResetView();
}
-void PropertyEditor::instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList)
+void PropertyEditorView::instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList)
{
if (!m_selectedNode.isValid())
return;
@@ -998,94 +765,94 @@ void PropertyEditor::instancePropertyChange(const QList<QPair<ModelNode, Propert
}
-void PropertyEditor::nodeCreated(const ModelNode &/*createdNode*/)
+void PropertyEditorView::nodeCreated(const ModelNode &/*createdNode*/)
{
}
-void PropertyEditor::nodeRemoved(const ModelNode &/*removedNode*/, const NodeAbstractProperty &/*parentProperty*/, AbstractView::PropertyChangeFlags /*propertyChange*/)
+void PropertyEditorView::nodeRemoved(const ModelNode &/*removedNode*/, const NodeAbstractProperty &/*parentProperty*/, AbstractView::PropertyChangeFlags /*propertyChange*/)
{
}
-void PropertyEditor::nodeAboutToBeReparented(const ModelNode &/*node*/, const NodeAbstractProperty &/*newPropertyParent*/, const NodeAbstractProperty &/*oldPropertyParent*/, AbstractView::PropertyChangeFlags /*propertyChange*/)
+void PropertyEditorView::nodeAboutToBeReparented(const ModelNode &/*node*/, const NodeAbstractProperty &/*newPropertyParent*/, const NodeAbstractProperty &/*oldPropertyParent*/, AbstractView::PropertyChangeFlags /*propertyChange*/)
{
}
-void PropertyEditor::nodeReparented(const ModelNode &/*node*/, const NodeAbstractProperty &/*newPropertyParent*/, const NodeAbstractProperty &/*oldPropertyParent*/, AbstractView::PropertyChangeFlags /*propertyChange*/)
+void PropertyEditorView::nodeReparented(const ModelNode &/*node*/, const NodeAbstractProperty &/*newPropertyParent*/, const NodeAbstractProperty &/*oldPropertyParent*/, AbstractView::PropertyChangeFlags /*propertyChange*/)
{
}
-void PropertyEditor::propertiesAboutToBeRemoved(const QList<AbstractProperty> &/*propertyList*/)
+void PropertyEditorView::propertiesAboutToBeRemoved(const QList<AbstractProperty> &/*propertyList*/)
{
}
-void PropertyEditor::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/)
+void PropertyEditorView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/)
{
// TODO: we should react to this case
}
-void PropertyEditor::instancesCompleted(const QVector<ModelNode> &/*completedNodeList*/)
+void PropertyEditorView::instancesCompleted(const QVector<ModelNode> &/*completedNodeList*/)
{
}
-void PropertyEditor::instancesRenderImageChanged(const QVector<ModelNode> &/*nodeList*/)
+void PropertyEditorView::instancesRenderImageChanged(const QVector<ModelNode> &/*nodeList*/)
{
}
-void PropertyEditor::instancesPreviewImageChanged(const QVector<ModelNode> &/*nodeList*/)
+void PropertyEditorView::instancesPreviewImageChanged(const QVector<ModelNode> &/*nodeList*/)
{
}
-void PropertyEditor::instancesChildrenChanged(const QVector<ModelNode> &/*nodeList*/)
+void PropertyEditorView::instancesChildrenChanged(const QVector<ModelNode> &/*nodeList*/)
{
}
-void PropertyEditor::instancesToken(const QString &/*tokenName*/, int /*tokenNumber*/, const QVector<ModelNode> &/*nodeVector*/)
+void PropertyEditorView::instancesToken(const QString &/*tokenName*/, int /*tokenNumber*/, const QVector<ModelNode> &/*nodeVector*/)
{
}
-void PropertyEditor::nodeSourceChanged(const ModelNode &/*modelNode*/, const QString &/*newNodeSource*/)
+void PropertyEditorView::nodeSourceChanged(const ModelNode &/*modelNode*/, const QString &/*newNodeSource*/)
{
}
-void PropertyEditor::rewriterBeginTransaction()
+void PropertyEditorView::rewriterBeginTransaction()
{
}
-void PropertyEditor::rewriterEndTransaction()
+void PropertyEditorView::rewriterEndTransaction()
{
}
-void PropertyEditor::nodeOrderChanged(const NodeListProperty &/*listProperty*/, const ModelNode &/*movedNode*/, int /*oldIndex*/)
+void PropertyEditorView::nodeOrderChanged(const NodeListProperty &/*listProperty*/, const ModelNode &/*movedNode*/, int /*oldIndex*/)
{
}
-void PropertyEditor::importsChanged(const QList<Import> &/*addedImports*/, const QList<Import> &/*removedImports*/)
+void PropertyEditorView::importsChanged(const QList<Import> &/*addedImports*/, const QList<Import> &/*removedImports*/)
{
}
-void PropertyEditor::setValue(const QmlObjectNode &qmlObjectNode, const PropertyName &name, const QVariant &value)
+void PropertyEditorView::setValue(const QmlObjectNode &qmlObjectNode, const PropertyName &name, const QVariant &value)
{
m_locked = true;
m_currentType->setValue(qmlObjectNode, name, value);
m_locked = false;
}
-void PropertyEditor::reloadQml()
+void PropertyEditorView::reloadQml()
{
m_typeHash.clear();
while (QWidget *widget = m_stackedWidget->widget(0)) {
@@ -1097,7 +864,7 @@ void PropertyEditor::reloadQml()
delayedResetView();
}
-QString PropertyEditor::qmlFileName(const NodeMetaInfo &nodeInfo) const
+QString PropertyEditorView::qmlFileName(const NodeMetaInfo &nodeInfo) const
{
if (nodeInfo.typeName().split('.').last() == "QDeclarativeItem")
return "QtQuick/ItemPane.qml";
@@ -1105,7 +872,7 @@ QString PropertyEditor::qmlFileName(const NodeMetaInfo &nodeInfo) const
return fixedTypeName + QLatin1String("Pane.qml");
}
-QUrl PropertyEditor::fileToUrl(const QString &filePath) const {
+QUrl PropertyEditorView::fileToUrl(const QString &filePath) const {
QUrl fileUrl;
if (filePath.isEmpty())
@@ -1123,7 +890,7 @@ QUrl PropertyEditor::fileToUrl(const QString &filePath) const {
return fileUrl;
}
-QString PropertyEditor::fileFromUrl(const QUrl &url) const
+QString PropertyEditorView::fileFromUrl(const QUrl &url) const
{
if (url.scheme() == QLatin1String("qrc")) {
const QString &path = url.path();
@@ -1133,7 +900,7 @@ QString PropertyEditor::fileFromUrl(const QUrl &url) const
return url.toLocalFile();
}
-QUrl PropertyEditor::qmlForNode(const ModelNode &modelNode, TypeName &className) const
+QUrl PropertyEditorView::qmlForNode(const ModelNode &modelNode, TypeName &className) const
{
if (modelNode.isValid()) {
QList<NodeMetaInfo> hierarchy;
@@ -1151,9 +918,10 @@ QUrl PropertyEditor::qmlForNode(const ModelNode &modelNode, TypeName &className)
return fileToUrl(QDir(m_qmlDir).filePath("QtQuick/emptyPane.qml"));
}
-QString PropertyEditor::locateQmlFile(const NodeMetaInfo &info, const QString &relativePath) const
+QString PropertyEditorView::locateQmlFile(const NodeMetaInfo &info, const QString &relativePath) const
{
QDir fileSystemDir(m_qmlDir);
+
static QDir resourcesDir(resourcePropertyEditorPath);
QDir importDir(info.importDirectoryPath() + QLatin1String(Constants::QML_DESIGNER_SUBFOLDER));
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.h
index 46ba909692..96220ed786 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.h
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.h
@@ -27,19 +27,15 @@
**
****************************************************************************/
-#ifndef PROPERTYEDITOR_H
-#define PROPERTYEDITOR_H
+#ifndef PROPERTYEDITORVIEW_H
+#define PROPERTYEDITORVIEW_H
#include <abstractview.h>
-#include <declarativewidgetview.h>
#include <QHash>
-#include <QStackedWidget>
#include <QTimer>
-#include "qmlanchorbindingproxy.h"
-#include "designerpropertymap.h"
-#include "propertyeditorvalue.h"
-#include "propertyeditorcontextobject.h"
+#include "propertyeditorqmlbackend.h"
+#include "propertyeditorwidget.h"
QT_BEGIN_NAMESPACE
class QShortcut;
@@ -47,38 +43,20 @@ class QStackedWidget;
class QTimer;
QT_END_NAMESPACE
-class PropertyEditorValue;
-
namespace QmlDesigner {
class PropertyEditorTransaction;
class CollapseButton;
-class StackedWidget;
+class PropertyEditorWidget;
+class PropertyEditorView;
-class PropertyEditor: public AbstractView
+class PropertyEditorView: public AbstractView
{
Q_OBJECT
- class NodeType {
- public:
- NodeType(PropertyEditor *propertyEditor);
- ~NodeType();
-
- void setup(const QmlObjectNode &fxObjectNode, const QString &stateName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor);
- void initialSetup(const TypeName &typeName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor);
- void setValue(const QmlObjectNode &fxObjectNode, const PropertyName &name, const QVariant &value);
-
- DeclarativeWidgetView *m_view;
- Internal::QmlAnchorBindingProxy m_backendAnchorBinding;
- DesignerPropertyMap<PropertyEditorValue> m_backendValuesPropertyMap;
- QScopedPointer<PropertyEditorTransaction> m_propertyEditorTransaction;
- QScopedPointer<PropertyEditorValue> m_dummyPropertyEditorValue;
- QScopedPointer<PropertyEditorContextObject> m_contextObject;
- };
-
public:
- PropertyEditor(QWidget *parent = 0);
- ~PropertyEditor();
+ PropertyEditorView(QWidget *parent = 0);
+ ~PropertyEditorView();
void setQmlDir(const QString &qmlDirPath);
@@ -149,38 +127,20 @@ private: //functions
void delayedResetView();
-
private: //variables
ModelNode m_selectedNode;
QWidget *m_parent;
QShortcut *m_updateShortcut;
int m_timerId;
- StackedWidget* m_stackedWidget;
+ PropertyEditorWidget* m_stackedWidget;
QString m_qmlDir;
- QHash<QString, NodeType *> m_typeHash;
- NodeType *m_currentType;
+ QHash<QString, PropertyEditorQmlBackend *> m_typeHash;
+ PropertyEditorQmlBackend *m_currentType;
bool m_locked;
bool m_setupCompleted;
QTimer *m_singleShotTimer;
};
+} //QmlDesigner
-class StackedWidget : public QStackedWidget
-{
-Q_OBJECT
-
-public:
- StackedWidget(QWidget *parent = 0) : QStackedWidget(parent) {}
-
-signals:
- void resized();
-protected:
- void resizeEvent(QResizeEvent * event)
- {
- QStackedWidget::resizeEvent(event);
- emit resized();
- }
-};
-}
-
-#endif // PROPERTYEDITOR_H
+#endif // PROPERTYEDITORVIEW_H
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorwidget.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorwidget.cpp
new file mode 100644
index 0000000000..919766d3bf
--- /dev/null
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorwidget.cpp
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "propertyeditorwidget.h"
+
+
+namespace QmlDesigner {
+
+PropertyEditorWidget::PropertyEditorWidget(QWidget *parent) : QStackedWidget(parent)
+{
+}
+
+void PropertyEditorWidget::resizeEvent(QResizeEvent * event)
+{
+ QStackedWidget::resizeEvent(event);
+ emit resized();
+}
+
+}
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorwidget.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorwidget.h
new file mode 100644
index 0000000000..d34e1951fc
--- /dev/null
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorwidget.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef PROPERTYEDITORWIDGET_H
+#define PROPERTYEDITORWIDGET_H
+
+#include <QStackedWidget>
+
+namespace QmlDesigner {
+
+class PropertyEditorWidget : public QStackedWidget
+{
+
+Q_OBJECT
+
+public:
+ PropertyEditorWidget(QWidget *parent = 0);
+
+signals:
+ void resized();
+
+protected:
+ void resizeEvent(QResizeEvent * event);
+};
+
+} //QmlDesigner
+
+#endif //PROPERTYEDITORWIDGET_H
diff --git a/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.cpp b/src/plugins/qmldesigner/components/propertyeditor/quickpropertyeditorview.cpp
index 9db2ce5ac6..dcabb43f76 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/quickpropertyeditorview.cpp
@@ -27,7 +27,7 @@
**
****************************************************************************/
-#include "declarativewidgetview.h"
+#include "quickpropertyeditorview.h"
#include <QDeclarativeItem>
#include <QDeclarativeEngine>
@@ -35,7 +35,7 @@
namespace QmlDesigner {
-void DeclarativeWidgetView::execute()
+void QuickPropertyEditorView::execute()
{
if (m_root)
delete m_root.data();
@@ -52,47 +52,47 @@ void DeclarativeWidgetView::execute()
}
}
-DeclarativeWidgetView::DeclarativeWidgetView(QWidget *parent) :
+QuickPropertyEditorView::QuickPropertyEditorView(QWidget *parent) :
QWidget(parent)
{
}
-QUrl DeclarativeWidgetView::source() const
+QUrl QuickPropertyEditorView::source() const
{
return m_source;
}
-void DeclarativeWidgetView::setSource(const QUrl& url)
+void QuickPropertyEditorView::setSource(const QUrl& url)
{
m_source = url;
execute();
}
-QDeclarativeEngine* DeclarativeWidgetView::engine()
+QDeclarativeEngine* QuickPropertyEditorView::engine()
{
return &m_engine;
}
-QWidget *DeclarativeWidgetView::rootWidget() const
+QWidget *QuickPropertyEditorView::rootWidget() const
{
return m_root.data();
}
-QDeclarativeContext* DeclarativeWidgetView::rootContext()
+QDeclarativeContext* QuickPropertyEditorView::rootContext()
{
return m_engine.rootContext();
}
-DeclarativeWidgetView::Status DeclarativeWidgetView::status() const
+QuickPropertyEditorView::Status QuickPropertyEditorView::status() const
{
if (!m_component)
- return DeclarativeWidgetView::Null;
+ return QuickPropertyEditorView::Null;
- return DeclarativeWidgetView::Status(m_component->status());
+ return QuickPropertyEditorView::Status(m_component->status());
}
-void DeclarativeWidgetView::continueExecute()
+void QuickPropertyEditorView::continueExecute()
{
disconnect(m_component.data(), SIGNAL(statusChanged(QDeclarativeComponent::Status)), this, SLOT(continueExecute()));
@@ -121,7 +121,7 @@ void DeclarativeWidgetView::continueExecute()
emit statusChanged(status());
}
-void DeclarativeWidgetView::setRootWidget(QWidget *widget)
+void QuickPropertyEditorView::setRootWidget(QWidget *widget)
{
if (m_root.data() == widget)
return;
diff --git a/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.h b/src/plugins/qmldesigner/components/propertyeditor/quickpropertyeditorview.h
index 626814244d..56fa25b1e5 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/declarativewidgetview.h
+++ b/src/plugins/qmldesigner/components/propertyeditor/quickpropertyeditorview.h
@@ -27,12 +27,13 @@
**
****************************************************************************/
-#ifndef DECLARATIVEWIDGETVIEW_H
-#define DECLARATIVEWIDGETVIEW_H
+#ifndef QUICKPROERTYEDITORVIEW_H
+#define QUICKPROERTYEDITORVIEW_H
#include <QWidget>
#include <QUrl>
#include <QDeclarativeEngine>
+#include <QDeclarativeContext>
QT_BEGIN_NAMESPACE
class QDeclarativeContext;
@@ -42,13 +43,13 @@ QT_END_NAMESPACE
namespace QmlDesigner {
-class DeclarativeWidgetView : public QWidget
+class QuickPropertyEditorView : public QWidget
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource DESIGNABLE true)
public:
- explicit DeclarativeWidgetView(QWidget *parent = 0);
+ explicit QuickPropertyEditorView(QWidget *parent = 0);
QUrl source() const;
void setSource(const QUrl&);
@@ -62,7 +63,7 @@ public:
Status status() const;
signals:
- void statusChanged(DeclarativeWidgetView::Status);
+ void statusChanged(QuickPropertyEditorView::Status);
protected:
void setRootWidget(QWidget *);
@@ -81,4 +82,4 @@ private:
} //QmlDesigner
-#endif // DECLARATIVEWIDGETVIEW_H
+#endif // QUICKPROERTYEDITORVIEW_H
diff --git a/src/plugins/qmldesigner/designercore/include/viewmanager.h b/src/plugins/qmldesigner/designercore/include/viewmanager.h
index 5a4f76d0e8..c21c765263 100644
--- a/src/plugins/qmldesigner/designercore/include/viewmanager.h
+++ b/src/plugins/qmldesigner/designercore/include/viewmanager.h
@@ -38,7 +38,7 @@
#include <navigatorview.h>
#include <stateseditorview.h>
#include <formeditorview.h>
-#include <propertyeditor.h>
+#include <propertyeditorview.h>
#include <componentview.h>
#include <debugview.h>
#include <QWidgetAction>
@@ -111,7 +111,7 @@ private: // variables
FormEditorView m_formEditorView;
ItemLibraryView m_itemLibraryView;
NavigatorView m_navigatorView;
- PropertyEditor m_propertyEditorView;
+ PropertyEditorView m_propertyEditorView;
StatesEditorView m_statesEditorView;
NodeInstanceView m_nodeInstanceView;