ui: Added expand and collapse node actions to graph view context menu

* expand/collapse node via graph view context menu
* also possible with Shift + Left Click
This commit is contained in:
Eberhard Graether
2018-08-05 19:49:18 +02:00
parent f9b43526f4
commit ae7b827b0c
7 changed files with 113 additions and 14 deletions
@@ -11,7 +11,9 @@
#include "qt/utility/utilityQt.h"
#include "qt/view/graphElements/nodeComponents/QtGraphNodeComponent.h"
#include "qt/view/graphElements/QtGraphEdge.h"
#include "qt/view/graphElements/QtGraphNodeExpandToggle.h"
#include "utility/messaging/type/code/MessageCodeShowDefinition.h"
#include "utility/messaging/type/MessageGraphNodeExpand.h"
#include "utility/messaging/type/MessageGraphNodeHide.h"
#include "utility/messaging/type/MessageGraphNodeMove.h"
#include "utility/ResourcePaths.h"
@@ -394,6 +396,23 @@ void QtGraphNode::onHide()
}
}
void QtGraphNode::onCollapseExpand()
{
for (auto subNode : getSubNodes())
{
if (subNode->isExpandToggleNode())
{
MessageGraphNodeExpand(getTokenId(), !dynamic_cast<QtGraphNodeExpandToggle*>(subNode)->isExpanded()).dispatch();
return;
}
}
if (getParent())
{
getParent()->onCollapseExpand();
}
}
void QtGraphNode::onShowDefinition()
{
Id tokenId = getTokenId();