Commit bb1a76c0 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.Model: Adding SignalHandlerProperty

SignalHandlerProperty allows editing convenient editing of signal
handlers like onMousePress in the model.
The interface is analogous to BindingProperty.

Since mos views do not care about SignalHandlerProperties and
they should not be mixed up with BindingProperties they are different
types.

I also added the signalHandlerPropertiesChanged() notifier to AbstractView.

Change-Id: I68bc7d2c5d3b991944e8f8d698212a1dfef218bf
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent d5e41c08
......@@ -34,6 +34,7 @@
#include <designersettings.h>
#include <bindingproperty.h>
#include <signalhandlerproperty.h>
#include <nodeabstractproperty.h>
#include <variantproperty.h>
......@@ -185,6 +186,19 @@ void DebugView::bindingPropertiesChanged(const QList<BindingProperty> &propertyL
}
}
void DebugView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> &propertyList, AbstractView::PropertyChangeFlags propertyChange)
{
if (isDebugViewEnabled()) {
QTextStream message;
QString string;
message.setString(&string);
foreach (const SignalHandlerProperty &property, propertyList) {
message << property;
}
log(tr("SignalHandlerProperties changed:"), string);
}
}
void DebugView::rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion)
{
if (isDebugViewEnabled()) {
......
......@@ -60,6 +60,7 @@ public:
void propertiesAboutToBeRemoved(const QList<AbstractProperty>& propertyList) QTC_OVERRIDE;
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) QTC_OVERRIDE;
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
......
......@@ -279,6 +279,10 @@ void FormEditorView::bindingPropertiesChanged(const QList<BindingProperty>& prop
QmlModelView::bindingPropertiesChanged(propertyList, propertyChange);
}
void FormEditorView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> & /*propertyList*/, AbstractView::PropertyChangeFlags /*propertyChange*/)
{
}
WidgetInfo FormEditorView::widgetInfo()
{
return createWidgetInfo(m_formEditorWidget.data(), 0, "FormEditor", WidgetInfo::CentralPane, 0, tr("Form Editor"));
......
......@@ -78,6 +78,7 @@ public:
void propertiesAboutToBeRemoved(const QList<AbstractProperty>& propertyList) QTC_OVERRIDE;
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) QTC_OVERRIDE;
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
......
......@@ -188,6 +188,7 @@ void ComponentView::propertiesAboutToBeRemoved(const QList<AbstractProperty>& /*
void ComponentView::propertiesRemoved(const QList<AbstractProperty>& /*propertyList*/) {}
void ComponentView::variantPropertiesChanged(const QList<VariantProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/) {}
void ComponentView::bindingPropertiesChanged(const QList<BindingProperty>& /*propertyList*/, PropertyChangeFlags /*propertyChange*/) {}
void ComponentView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> & /*propertyList*/, AbstractView::PropertyChangeFlags /*propertyChange*/) {}
void ComponentView::rootNodeTypeChanged(const QString &/*type*/, int /*majorVersion*/, int /*minorVersion*/) {}
void ComponentView::scriptFunctionsChanged(const ModelNode &/*node*/, const QStringList &/*scriptFunctionList*/) {}
void ComponentView::instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &/*propertyList*/) {}
......
......@@ -78,6 +78,8 @@ public:
PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList,
PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList,
PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) QTC_OVERRIDE;
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList) QTC_OVERRIDE;
void instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList) QTC_OVERRIDE;
......
......@@ -59,6 +59,9 @@ void DesignDocumentView::propertiesAboutToBeRemoved(const QList<AbstractProperty
void DesignDocumentView::propertiesRemoved(const QList<AbstractProperty>& /*propertyList*/) {}
void DesignDocumentView::variantPropertiesChanged(const QList<VariantProperty>& /*propertyList*/, AbstractView::PropertyChangeFlags /*propertyChange*/) {}
void DesignDocumentView::bindingPropertiesChanged(const QList<BindingProperty>& /*propertyList*/, AbstractView::PropertyChangeFlags /*propertyChange*/) {}
void DesignDocumentView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> & /*propertyList*/,
AbstractView::PropertyChangeFlags /*propertyChange*/)
{}
void DesignDocumentView::rootNodeTypeChanged(const QString & /*type*/, int /*majorVersion*/, int /*minorVersion*/) {}
void DesignDocumentView::selectedNodesChanged(const QList<ModelNode> & /*selectedNodeList*/,
......
......@@ -58,6 +58,7 @@ public:
virtual void propertiesRemoved(const QList<AbstractProperty>& propertyList) QTC_OVERRIDE;
virtual void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
virtual void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
virtual void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
virtual void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) QTC_OVERRIDE;
virtual void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
......
......@@ -103,6 +103,10 @@ void ItemLibraryView::bindingPropertiesChanged(const QList<BindingProperty> &, P
}
void ItemLibraryView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> &, AbstractView::PropertyChangeFlags)
{
}
void ItemLibraryView::nodeAboutToBeRemoved(const ModelNode &)
{
......
......@@ -65,6 +65,8 @@ public:
PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty> &propertyList,
PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList,
PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void nodeAboutToBeRemoved(const ModelNode &removedNode) QTC_OVERRIDE;
void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex) QTC_OVERRIDE;
......
......@@ -162,6 +162,11 @@ void NavigatorView::bindingPropertiesChanged(const QList<BindingProperty> & /*pr
{
}
void NavigatorView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> & /*propertyList*/,
AbstractView::PropertyChangeFlags /*propertyChange*/)
{
}
void NavigatorView::nodeAboutToBeRemoved(const ModelNode &removedNode)
{
if (m_treeModel->isInTree(removedNode))
......
......@@ -70,6 +70,7 @@ public:
void propertiesRemoved(const QList<AbstractProperty> &propertyList) QTC_OVERRIDE;
void variantPropertiesChanged(const QList<VariantProperty> &propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty> &propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList,PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void nodeAboutToBeRemoved(const ModelNode &removedNode) QTC_OVERRIDE;
void nodeOrderChanged(const NodeListProperty &listProperty, const ModelNode &movedNode, int oldIndex) QTC_OVERRIDE;
......
......@@ -916,6 +916,11 @@ void PropertyEditor::bindingPropertiesChanged(const QList<BindingProperty>& prop
}
}
void PropertyEditor::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> & /*propertyList*/,
AbstractView::PropertyChangeFlags /*propertyChange*/)
{
}
void PropertyEditor::instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash)
{
......
......@@ -100,6 +100,7 @@ public:
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList,PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash) QTC_OVERRIDE;
......
......@@ -342,6 +342,12 @@ void StatesEditorView::bindingPropertiesChanged(const QList<BindingProperty> &/*
}
void StatesEditorView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> & /*propertyList*/,
AbstractView::PropertyChangeFlags /*propertyChange*/)
{
}
void StatesEditorView::selectedNodesChanged(const QList<ModelNode> &/*selectedNodeList*/, const QList<ModelNode> &/*lastSelectedNodeList*/)
{
......
......@@ -76,6 +76,7 @@ public:
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList) QTC_OVERRIDE;
void nodeIdChanged(const ModelNode &node, const QString &newId, const QString &oldId) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty> &propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList,PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList, const QList<ModelNode> &lastSelectedNodeList) QTC_OVERRIDE;
void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList) QTC_OVERRIDE;
......
......@@ -76,7 +76,9 @@ SOURCES += $$PWD/model/abstractview.cpp \
$$PWD/model/qmltextgenerator.cpp \
$$PWD/model/modelmerger.cpp \
$$PWD/exceptions/rewritingexception.cpp \
$$PWD/model/viewmanager.cpp
$$PWD/model/viewmanager.cpp \
$$PWD/model/signalhandlerproperty.cpp \
$$PWD/model/internalsignalhandlerproperty.cpp
HEADERS += $$PWD/include/qmldesignercorelib_global.h \
$$PWD/include/abstractview.h \
......@@ -147,7 +149,9 @@ HEADERS += $$PWD/include/qmldesignercorelib_global.h \
$$PWD/include/mathutils.h \
$$PWD/include/customnotifications.h \
$$PWD/include/rewritingexception.h \
$$PWD/include/viewmanager.h
$$PWD/include/viewmanager.h \
$$PWD/include/signalhandlerproperty.h \
$$PWD/model/internalsignalhandlerproperty.h
contains(CONFIG, plugin) {
# If core.pri has been included in the qmldesigner plugin
......
......@@ -57,6 +57,7 @@ class QMLDESIGNERCORE_EXPORT NodeListProperty;
class QMLDESIGNERCORE_EXPORT NodeAbstractProperty;
class QMLDESIGNERCORE_EXPORT BindingProperty;
class QMLDESIGNERCORE_EXPORT NodeProperty;
class QMLDESIGNERCORE_EXPORT SignalHandlerProperty;
class QmlObjectNode;
......@@ -93,12 +94,14 @@ public:
NodeAbstractProperty toNodeAbstractProperty() const;
BindingProperty toBindingProperty() const;
NodeProperty toNodeProperty() const;
SignalHandlerProperty toSignalHandlerProperty() const;
bool isVariantProperty() const;
bool isNodeListProperty() const;
bool isNodeAbstractProperty() const;
bool isBindingProperty() const;
bool isNodeProperty() const;
bool isSignalHandlerProperty() const;
bool isDynamic() const;
TypeName dynamicTypeName() const;
......
......@@ -190,6 +190,7 @@ public:
virtual void propertiesRemoved(const QList<AbstractProperty>& propertyList) = 0;
virtual void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) = 0;
virtual void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) = 0;
virtual void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList, PropertyChangeFlags propertyChange) = 0;
virtual void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) = 0;
virtual void instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList) = 0;
......
......@@ -62,6 +62,7 @@ public:
void propertiesRemoved(const QList<AbstractProperty>& propertyList);
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange);
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange);
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList,PropertyChangeFlags propertyChange);
void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion);
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
......@@ -185,6 +186,12 @@ void ForwardView<ViewType>::bindingPropertiesChanged(const QList<BindingProperty
view->bindingPropertiesChanged(adjustedList(propertyList, view.data()), propertyChange);
}
void ForwardView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> &propertyList, AbstractView::PropertyChangeFlags propertyChange)
{
foreach (const ViewTypePointer &view, m_targetViewList)
view->signalHandlerPropertiesChanged(adjustedList(propertyList, view.data()), propertyChange);
}
template <class ViewType>
void ForwardView<ViewType>::rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion)
{
......
......@@ -56,6 +56,7 @@ class NodeMetaInfo;
class AbstractProperty;
class BindingProperty;
class VariantProperty;
class SignalHandlerProperty;
class Model;
class AbstractView;
class NodeListProperty;
......@@ -120,6 +121,7 @@ public:
AbstractProperty property(const PropertyName &name) const;
VariantProperty variantProperty(const PropertyName &name) const;
BindingProperty bindingProperty(const PropertyName &name) const;
SignalHandlerProperty signalHandlerProperty(const PropertyName &name) const;
NodeListProperty nodeListProperty(const PropertyName &name) const;
NodeProperty nodeProperty(const PropertyName &name) const;
NodeAbstractProperty nodeAbstractProperty(const PropertyName &name) const;
......
......@@ -91,6 +91,7 @@ public:
void propertiesRemoved(const QList<AbstractProperty>& propertyList) QTC_OVERRIDE;
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> &propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void nodeAboutToBeReparented(const ModelNode &node,
const NodeAbstractProperty &newPropertyParent,
const NodeAbstractProperty &oldPropertyParent,
......
......@@ -118,6 +118,7 @@ public:
void propertiesRemoved(const QList<AbstractProperty>& propertyList) QTC_OVERRIDE;
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList,PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList) QTC_OVERRIDE;
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList, const QList<ModelNode> &lastSelectedNodeList) QTC_OVERRIDE;
......
......@@ -127,6 +127,7 @@ public:
void propertiesRemoved(const QList<AbstractProperty>& propertyList) QTC_OVERRIDE;
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty>& propertyList,PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void nodeAboutToBeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent,
const NodeAbstractProperty &oldPropertyParent,
AbstractView::PropertyChangeFlags propertyChange) QTC_OVERRIDE;
......
/****************************************************************************
**
** 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 SIGNALHANDLERPROPERTY_H
#define SIGNALHANDLERPROPERTY_H
#include "qmldesignercorelib_global.h"
#include "abstractproperty.h"
namespace QmlDesigner {
class QMLDESIGNERCORE_EXPORT SignalHandlerProperty : public QmlDesigner::AbstractProperty
{
friend class QmlDesigner::ModelNode;
friend class QmlDesigner::Internal::ModelPrivate;
friend class QmlDesigner::AbstractProperty;
public:
void setSource(const QString &source);
QString source() const;
SignalHandlerProperty& operator= (const QString &source);
SignalHandlerProperty();
SignalHandlerProperty(const SignalHandlerProperty &property, AbstractView *view);
protected:
SignalHandlerProperty(const PropertyName &propertyName, const Internal::InternalNodePointer &internalNode, Model* model, AbstractView *view);
};
} // namespace QmlDesigner
#endif // SIGNALHANDLERPROPERTY_H
......@@ -376,6 +376,11 @@ void NodeInstanceView::bindingPropertiesChanged(const QList<BindingProperty>& pr
nodeInstanceServer()->changePropertyBindings(createChangeBindingCommand(propertyList));
}
void NodeInstanceView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> & /*propertyList*/,
AbstractView::PropertyChangeFlags /*propertyChange*/)
{
}
/*! \brief Notifing the view that a AbstractProperty value was changed to a ModelNode.
The property will be set for the NodeInstance.
......
......@@ -37,6 +37,7 @@
#include "invalidpropertyexception.h"
#include "variantproperty.h"
#include "bindingproperty.h"
#include "signalhandlerproperty.h"
#include "nodeproperty.h"
#include "nodeabstractproperty.h"
#include "nodelistproperty.h"
......@@ -257,6 +258,19 @@ NodeProperty AbstractProperty::toNodeProperty() const
return NodeProperty();
}
SignalHandlerProperty AbstractProperty::toSignalHandlerProperty() const
{
if (!isValid())
throw InvalidPropertyException(__LINE__, __FUNCTION__, __FILE__, m_propertyName);
SignalHandlerProperty propertyNode(name(), internalNode(), model(), view());
if (propertyNode.isSignalHandlerProperty())
return propertyNode;
return SignalHandlerProperty();
}
NodeListProperty AbstractProperty::toNodeListProperty() const
{
if (!isValid())
......@@ -348,6 +362,19 @@ bool AbstractProperty::isNodeProperty() const
return false;
}
bool AbstractProperty::isSignalHandlerProperty() const
{
if (!isValid())
throw InvalidPropertyException(__LINE__, __FUNCTION__, __FILE__, m_propertyName);
if (internalNode()->hasProperty(name())) {
Q_ASSERT(internalNode()->property(name()));
return internalNode()->property(name())->isSignalHandlerProperty();
}
return false;
}
bool AbstractProperty::isBindingProperty() const
{
......
......@@ -200,6 +200,15 @@ InternalBindingProperty::Pointer InternalNode::bindingProperty(const PropertyNam
return InternalBindingProperty::Pointer();
}
InternalSignalHandlerProperty::Pointer InternalNode::signalHandlerProperty(const PropertyName &name) const
{
InternalProperty::Pointer property = m_namePropertyHash.value(name);
if (property->isSignalHandlerProperty())
return property.staticCast<InternalSignalHandlerProperty>();
return InternalSignalHandlerProperty::Pointer();
}
InternalVariantProperty::Pointer InternalNode::variantProperty(const PropertyName &name) const
{
InternalProperty::Pointer property = m_namePropertyHash.value(name);
......@@ -215,6 +224,12 @@ void InternalNode::addBindingProperty(const PropertyName &name)
m_namePropertyHash.insert(name, newProperty);
}
void InternalNode::addSignalHandlerProperty(const PropertyName &name)
{
InternalProperty::Pointer newProperty(InternalSignalHandlerProperty::create(name, internalPointer()));
m_namePropertyHash.insert(name, newProperty);
}
InternalNodeListProperty::Pointer InternalNode::nodeListProperty(const PropertyName &name) const
{
InternalProperty::Pointer property = m_namePropertyHash.value(name);
......
......@@ -38,6 +38,7 @@
#include "internalproperty.h"
#include "internalvariantproperty.h"
#include "internalbindingproperty.h"
#include "internalsignalhandlerproperty.h"
#include "internalnodelistproperty.h"
#include "internalnodeproperty.h"
#include "internalnodeabstractproperty.h"
......@@ -93,12 +94,14 @@ public:
InternalProperty::Pointer property(const PropertyName &name) const;
InternalBindingProperty::Pointer bindingProperty(const PropertyName &name) const;
InternalSignalHandlerProperty::Pointer signalHandlerProperty(const PropertyName &name) const;
InternalVariantProperty::Pointer variantProperty(const PropertyName &name) const;
InternalNodeListProperty::Pointer nodeListProperty(const PropertyName &name) const;
InternalNodeAbstractProperty::Pointer nodeAbstractProperty(const PropertyName &name) const;
InternalNodeProperty::Pointer nodeProperty(const PropertyName &name) const;
void addBindingProperty(const PropertyName &name);
void addSignalHandlerProperty(const PropertyName &name);
void addNodeListProperty(const PropertyName &name);
void addVariantProperty(const PropertyName &name);
void addNodeProperty(const PropertyName &name);
......
......@@ -32,6 +32,7 @@
#include "internalvariantproperty.h"
#include "internalnodelistproperty.h"
#include "internalnodeproperty.h"
#include "internalsignalhandlerproperty.h"
#include "internalnode_p.h"
#include <QVariant>
#include <QString>
......@@ -116,6 +117,11 @@ bool InternalProperty::isNodeAbstractProperty() const
return false;
}
bool InternalProperty::isSignalHandlerProperty() const
{
return false;
}
QSharedPointer<InternalVariantProperty> InternalProperty::toVariantProperty() const
{
......@@ -146,6 +152,12 @@ QSharedPointer<InternalNodeAbstractProperty> InternalProperty::toNodeAbstractPro
return internalPointer().staticCast<InternalNodeAbstractProperty>();
}
QSharedPointer<InternalSignalHandlerProperty> InternalProperty::toSignalHandlerProperty() const
{
Q_ASSERT(internalPointer().dynamicCast<InternalSignalHandlerProperty>());
return internalPointer().staticCast<InternalSignalHandlerProperty>();
}
void InternalProperty::remove()
{
propertyOwner()->removeProperty(name());
......
......@@ -46,6 +46,7 @@ namespace QmlDesigner {
namespace Internal {
class InternalBindingProperty;
class InternalSignalHandlerProperty;
class InternalVariantProperty;
class InternalNodeListProperty;
class InternalNodeProperty;
......@@ -74,12 +75,14 @@ public:
virtual bool isNodeListProperty() const;
virtual bool isNodeProperty() const;
virtual bool isNodeAbstractProperty() const;
virtual bool isSignalHandlerProperty() const;
QSharedPointer<InternalBindingProperty> toBindingProperty() const;
QSharedPointer<InternalVariantProperty> toVariantProperty() const;
QSharedPointer<InternalNodeListProperty> toNodeListProperty() const;
QSharedPointer<InternalNodeProperty> toNodeProperty() const;
QSharedPointer<InternalNodeAbstractProperty> toNodeAbstractProperty() const;
QSharedPointer<InternalSignalHandlerProperty> toSignalHandlerProperty() const;
InternalNodePointer propertyOwner() const;
......
/****************************************************************************
**
** 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