Files
Sourcetrail/src/lib_gui/qt/view/graphElements/QtGraphEdge.h
T
Eberhard Graether f0b7dcdcdd ui: Show call graphs, inheritance trees and include trees for active symbol (issue 249 337)
* Added TrailLayouter with Sugiyama dependency layouting
* Layouter supports horizontal and vertical layouts
* Added basic ui to graph view for showing incoming and outgoing paths
* Added depth slider, with infinity at maximum
* Disable trail ui when not available
* Added trail messages to undo stack and only use last one when undoing
* Added QtGraphLineBezier for trail graphs and refactored other line types
* Disabled edge activation for trail layouts, shown only visually
* Highlight all connected edges when hovering a node in trail layout
* Use different color when highlighting call edges for better contrast
* Fixed BucketLayouter issue when edge does not leave node
* Increased click area for angled edges

bug id = 249 337

fortune cookie message = Answer just what the heart prompts to you.
2017-04-24 01:14:53 +02:00

94 lines
1.9 KiB
C++

#ifndef QT_GRAPH_EDGE_H
#define QT_GRAPH_EDGE_H
#include <memory>
#include <QGraphicsItem>
#include "utility/math/Vector2.h"
#include "utility/math/Vector4.h"
#include "data/graph/token_component/TokenComponentAggregation.h"
class Edge;
class QtGraphNode;
class QtGraphEdge
: public QObject
, public QGraphicsItemGroup
{
Q_OBJECT
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
public:
QtGraphEdge(
const std::weak_ptr<QtGraphNode>& owner,
const std::weak_ptr<QtGraphNode>& target,
const Edge* data,
size_t weight,
bool isActive,
TokenComponentAggregation::Direction direction);
virtual ~QtGraphEdge();
const Edge* getData() const;
std::weak_ptr<QtGraphNode> getOwner();
std::weak_ptr<QtGraphNode> getTarget();
void updateLine();
bool getIsActive() const;
void setIsActive(bool isActive);
void setFromAndToActive(bool fromActive, bool toActive);
void onClick();
void focusIn();
void focusOut();
void setDirection(TokenComponentAggregation::Direction direction);
bool isTrailEdge() const;
void setIsTrailEdge(std::vector<Vec4i> path, bool horizontal);
protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent* event);
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent* event);
private slots:
void dispatchMessageFocusIn();
private:
const Edge* m_data;
std::weak_ptr<QtGraphNode> m_owner;
std::weak_ptr<QtGraphNode> m_target;
QGraphicsLineItem* m_child;
bool m_isActive;
bool m_fromActive;
bool m_toActive;
bool m_isFocused;
size_t m_weight;
TokenComponentAggregation::Direction m_direction;
bool m_isTrailEdge;
bool m_isHorizontalTrail;
std::vector<Vec4i> m_path;
Vec2i m_mousePos;
bool m_mouseMoved;
bool m_willDispatchMessageFocusIn;
};
#endif // QT_GRAPH_EDGE_H