DiagramDesigner/include/nodeState.h

46 lines
953 B
C
Raw Normal View History

2024-12-03 20:07:25 +08:00
#pragma once
#include <QtCore/QPointF>
#include <QtCore/QPointer>
#include <QtCore/QUuid>
#include "global.h"
#include "nodeData.h"
class ConnectionGraphicsObject;
class NodeGraphicsObject;
/// Stores bool for hovering connections and resizing flag.
class NodeState
{
public:
NodeState(NodeGraphicsObject &ngo);
public:
bool hovered() const { return _hovered; }
void setHovered(bool hovered = true) { _hovered = hovered; }
void setResizing(bool resizing);
bool resizing() const;
ConnectionGraphicsObject const *connectionForReaction() const;
void storeConnectionForReaction(ConnectionGraphicsObject const *cgo);
void resetConnectionForReaction();
private:
NodeGraphicsObject &_ngo;
bool _hovered;
bool _resizing;
// QPointer tracks the QObject inside and is automatically cleared
// when the object is destroyed.
QPointer<ConnectionGraphicsObject const> _connectionForReaction;
};