logic: Clicking on group in inheritance graph expands it
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
#include "component/view/GraphViewStyle.h"
|
||||
#include "data/graph/Edge.h"
|
||||
#include "data/graph/token_component/TokenComponentAggregation.h"
|
||||
#include "data/graph/token_component/TokenComponentEdgeIds.h"
|
||||
#include "data/graph/token_component/TokenComponentInheritanceChain.h"
|
||||
#include "qt/graphics/QtLineItemAngled.h"
|
||||
#include "qt/graphics/QtLineItemBezier.h"
|
||||
@@ -250,24 +249,23 @@ void QtGraphEdge::setIsFocused(bool isFocused)
|
||||
|
||||
void QtGraphEdge::onClick()
|
||||
{
|
||||
if (isTrailEdge())
|
||||
{
|
||||
TokenComponentEdgeIds* componentEdgeIds = getData()->getComponent<TokenComponentEdgeIds>();
|
||||
std::vector<Id> ids = { getData()->getId() };
|
||||
Edge::EdgeType type = (getData() ? getData()->getType() : Edge::EDGE_AGGREGATION);
|
||||
|
||||
if (!getData() || m_owner->isGroupNode() || m_target->isGroupNode())
|
||||
{
|
||||
QtGraphNode* node =
|
||||
((m_direction == TokenComponentAggregation::DIRECTION_BACKWARD) == (type != Edge::EDGE_INHERITANCE))
|
||||
? m_owner : m_target;
|
||||
MessageGraphNodeBundleSplit(node->getTokenId()).dispatch();
|
||||
}
|
||||
else if (isTrailEdge())
|
||||
{
|
||||
MessageActivateTrailEdge(
|
||||
componentEdgeIds ? componentEdgeIds->edgeIds : ids,
|
||||
{ getData()->getId() },
|
||||
getData()->getType(),
|
||||
getData()->getFrom()->getNameHierarchy(),
|
||||
getData()->getTo()->getNameHierarchy()
|
||||
).dispatch();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!getData())
|
||||
{
|
||||
QtGraphNode* node = (m_direction == TokenComponentAggregation::DIRECTION_BACKWARD ? m_owner : m_target);
|
||||
MessageGraphNodeBundleSplit(node->getTokenId()).dispatch();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -4,12 +4,16 @@
|
||||
#include <QGraphicsRectItem>
|
||||
#include <QPen>
|
||||
|
||||
#include "utility/messaging/type/MessageGraphNodeBundleSplit.h"
|
||||
|
||||
#include "qt/graphics/QtRoundedRectItem.h"
|
||||
|
||||
QtGraphNodeGroup::QtGraphNodeGroup(Id tokenId, const std::wstring& name, NodeType::GroupType type)
|
||||
: m_tokenId(tokenId)
|
||||
, m_type(type)
|
||||
{
|
||||
setAcceptHoverEvents(true);
|
||||
|
||||
setName(name);
|
||||
setZValue(-10.0f);
|
||||
m_rect->setZValue(-10.0f);
|
||||
@@ -60,6 +64,11 @@ Id QtGraphNodeGroup::getTokenId() const
|
||||
return m_tokenId;
|
||||
}
|
||||
|
||||
void QtGraphNodeGroup::onClick()
|
||||
{
|
||||
MessageGraphNodeBundleSplit(m_tokenId).dispatch();
|
||||
}
|
||||
|
||||
void QtGraphNodeGroup::updateStyle()
|
||||
{
|
||||
GraphViewStyle::NodeStyle style = GraphViewStyle::getStyleOfGroupNode(m_type, false);
|
||||
|
||||
@@ -19,6 +19,7 @@ public:
|
||||
virtual bool isGroupNode() const;
|
||||
virtual Id getTokenId() const;
|
||||
|
||||
virtual void onClick();
|
||||
virtual void updateStyle();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user