forked from qt-creator/qt-creator
QmlDesigner: Add QmlObjectNode::getAllConnections
Change-Id: Id6fa6ecdf1173eea1087057f4317dd1a9c3f6b17 Reviewed-by: Aleksei German <aleksei.german@qt.io>
This commit is contained in:
@@ -140,6 +140,8 @@ public:
|
|||||||
|
|
||||||
QList<ModelNode> allTimelines() const;
|
QList<ModelNode> allTimelines() const;
|
||||||
|
|
||||||
|
QList<ModelNode> getAllConnections() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
NodeInstance nodeInstance() const;
|
NodeInstance nodeInstance() const;
|
||||||
QmlObjectNode nodeForInstance(const NodeInstance &instance) const;
|
QmlObjectNode nodeForInstance(const NodeInstance &instance) const;
|
||||||
|
@@ -45,6 +45,7 @@
|
|||||||
#include <qmldesignerplugin.h>
|
#include <qmldesignerplugin.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <utils/algorithm.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
@@ -608,6 +609,18 @@ QList<ModelNode> QmlObjectNode::allTimelines() const
|
|||||||
return timelineNodes;
|
return timelineNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<ModelNode> QmlObjectNode::getAllConnections() const
|
||||||
|
{
|
||||||
|
if (!isValid())
|
||||||
|
return {};
|
||||||
|
|
||||||
|
auto list = view()->allModelNodesOfType("QtQuick.Connections");
|
||||||
|
return Utils::filtered(list, [this](const ModelNode &connection) {
|
||||||
|
return connection.hasBindingProperty("target")
|
||||||
|
&& connection.bindingProperty("target").resolveToModelNode() == modelNode();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Removes a variant property of the object specified by \a name from the
|
Removes a variant property of the object specified by \a name from the
|
||||||
model.
|
model.
|
||||||
|
Reference in New Issue
Block a user