forked from paceholder/nodeeditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefaultVerticalNodeGeometry.hpp
More file actions
68 lines (45 loc) · 2.01 KB
/
DefaultVerticalNodeGeometry.hpp
File metadata and controls
68 lines (45 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once
#include "AbstractNodeGeometry.hpp"
#include <QtGui/QFontMetrics>
namespace QtNodes {
class AbstractGraphModel;
class BasicGraphicsScene;
class NODE_EDITOR_PUBLIC DefaultVerticalNodeGeometry : public AbstractNodeGeometry
{
public:
DefaultVerticalNodeGeometry(AbstractGraphModel &graphModel);
public:
QRectF boundingRect(NodeId const nodeId) const override;
QSize size(NodeId const nodeId) const override;
void recomputeSize(NodeId const nodeId) const override;
QPointF portPosition(NodeId const nodeId,
PortType const portType,
PortIndex const index) const override;
QPointF portTextPosition(NodeId const nodeId,
PortType const portType,
PortIndex const PortIndex) const override;
QPointF captionPosition(NodeId const nodeId) const override;
QRectF captionRect(NodeId const nodeId) const override;
QPointF labelPosition(const NodeId nodeId) const override;
QRectF labelRect(NodeId const nodeId) const override;
QPointF widgetPosition(NodeId const nodeId) const override;
QRect resizeHandleRect(NodeId const nodeId) const override;
int getPortSpacing() override { return _portSpacing; }
private:
QRectF portTextRect(NodeId const nodeId,
PortType const portType,
PortIndex const portIndex) const;
/// Finds
unsigned int maxHorizontalPortsExtent(NodeId const nodeId) const;
unsigned int maxPortsTextAdvance(NodeId const nodeId, PortType const portType) const;
unsigned int portCaptionsHeight(NodeId const nodeId, PortType const portType) const;
private:
// Some variables are mutable because we need to change drawing
// metrics corresponding to fontMetrics but this doesn't change
// constness of the Node.
mutable unsigned int _portSize;
unsigned int _portSpacing;
mutable QFontMetrics _fontMetrics;
mutable QFontMetrics _boldFontMetrics;
};
} // namespace QtNodes