diff --git a/src/plugins/qmldesigner/components/propertyeditor/designerpropertymap.cpp b/src/plugins/qmldesigner/components/propertyeditor/designerpropertymap.cpp new file mode 100644 index 00000000000..4c91e280378 --- /dev/null +++ b/src/plugins/qmldesigner/components/propertyeditor/designerpropertymap.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2014 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 "designerpropertymap.h" + +namespace QmlDesigner { + +DesignerPropertyMap::DesignerPropertyMap(QObject *parent) : QQmlPropertyMap(parent), m_defaultValue(new PropertyEditorValue(this)) +{ +} + +QVariant DesignerPropertyMap::value(const QString &key) const +{ + if (contains(key)) + return QQmlPropertyMap::value(key); + return QVariant::fromValue(m_defaultValue); +} + +void DesignerPropertyMap::registerDeclarativeType(const QString &name) +{ + qmlRegisterType("Bauhaus",1,0,name.toLatin1()); +} + +} //QmlDesigner + diff --git a/src/plugins/qmldesigner/components/propertyeditor/designerpropertymap.h b/src/plugins/qmldesigner/components/propertyeditor/designerpropertymap.h index eb93f5d53cb..e09e502632f 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/designerpropertymap.h +++ b/src/plugins/qmldesigner/components/propertyeditor/designerpropertymap.h @@ -32,10 +32,10 @@ #include #include +#include "propertyeditorvalue.h" namespace QmlDesigner { -template class DesignerPropertyMap : public QQmlPropertyMap { @@ -46,30 +46,9 @@ public: static void registerDeclarativeType(const QString &name); private: - DefaultType m_defaultValue; + PropertyEditorValue *m_defaultValue; }; -template -DesignerPropertyMap::DesignerPropertyMap(QObject *parent) : QQmlPropertyMap(parent), m_defaultValue(this) -{ -} - -template -QVariant DesignerPropertyMap::value(const QString &key) const -{ - if (contains(key)) - return QQmlPropertyMap::value(key); - return QVariant(&m_defaultValue); -} - - -template -void DesignerPropertyMap::registerDeclarativeType(const QString &name) -{ - typedef DesignerPropertyMap myType; - qmlRegisterType("Bauhaus",1,0,name); -} - } //QmlDesigner #endif // DESIGNERPROPERTYMAP_H diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri index 218293f4510..94056a40b84 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.pri @@ -4,6 +4,7 @@ SOURCES += propertyeditorview.cpp \ qmlanchorbindingproxy.cpp \ propertyeditorvalue.cpp \ propertyeditortransaction.cpp \ + designerpropertymap.cpp \ propertyeditorcontextobject.cpp \ quick2propertyeditorview.cpp \ propertyeditorqmlbackend.cpp \ diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp index 12f74c52185..b6eb32da916 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp @@ -222,7 +222,7 @@ Internal::QmlAnchorBindingProxy &PropertyEditorQmlBackend::backendAnchorBinding( return m_backendAnchorBinding; } -DesignerPropertyMap &PropertyEditorQmlBackend::backendValuesPropertyMap() { +DesignerPropertyMap &PropertyEditorQmlBackend::backendValuesPropertyMap() { return m_backendValuesPropertyMap; } diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h index 533b1e09e2c..959a0333caa 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.h @@ -59,7 +59,7 @@ public: QWidget *widget(); void setSource(const QUrl& url); Internal::QmlAnchorBindingProxy &backendAnchorBinding(); - DesignerPropertyMap &backendValuesPropertyMap(); + DesignerPropertyMap &backendValuesPropertyMap(); PropertyEditorTransaction *propertyEditorTransaction(); PropertyEditorValue *propertyValueForName(const QString &propertyName); @@ -88,7 +88,7 @@ private: private: Quick2PropertyEditorView *m_view; Internal::QmlAnchorBindingProxy m_backendAnchorBinding; - DesignerPropertyMap m_backendValuesPropertyMap; + DesignerPropertyMap m_backendValuesPropertyMap; QScopedPointer m_propertyEditorTransaction; QScopedPointer m_dummyPropertyEditorValue; QScopedPointer m_contextObject;