ui: extented graph view ui features
* fitting boxes to name length * highlighting active edges and nodes * hover for edges and nodes * single click selection for edges and nodes * edges have transparent second line for easier clicking * sub structure class members by public/protected/private
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <QGraphicsItem>
|
||||
|
||||
#include "utility/math/Vector2.h"
|
||||
#include "utility/messaging/type/MessageActivateToken.h"
|
||||
|
||||
#include "component/view/graphElements/GraphEdge.h"
|
||||
@@ -16,7 +17,7 @@ class QtGraphEdge
|
||||
, public QGraphicsLineItem
|
||||
{
|
||||
public:
|
||||
QtGraphEdge(const std::weak_ptr<GraphNode>& owner, const std::weak_ptr<GraphNode>& target, const Id id);
|
||||
QtGraphEdge(const std::weak_ptr<GraphNode>& owner, const std::weak_ptr<GraphNode>& target, const Edge* data);
|
||||
virtual ~QtGraphEdge();
|
||||
|
||||
virtual void ownerMoved();
|
||||
@@ -27,16 +28,29 @@ public:
|
||||
virtual std::weak_ptr<GraphNode> getOwner();
|
||||
virtual std::weak_ptr<GraphNode> getTarget();
|
||||
|
||||
virtual void setColor(const Vec4i& color);
|
||||
virtual Vec4i getColor() const;
|
||||
bool getIsActive() const;
|
||||
void setIsActive(bool isActive);
|
||||
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event);
|
||||
void onClick();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent* event);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
|
||||
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent* event);
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent* event);
|
||||
|
||||
private:
|
||||
std::weak_ptr<GraphNode> m_owner;
|
||||
std::weak_ptr<GraphNode> m_target;
|
||||
|
||||
Vec4i m_color;
|
||||
bool m_isActive;
|
||||
|
||||
QGraphicsLineItem* m_child;
|
||||
|
||||
Vec2i m_mousePos;
|
||||
bool m_mouseMoved;
|
||||
};
|
||||
|
||||
#endif // QT_GRAPH_EDGE_H
|
||||
|
||||
Reference in New Issue
Block a user