Commit bb1a76c0 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

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)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment