@@ -17,7 +17,7 @@ DefaultHorizontalNodeGeometry::
1717DefaultHorizontalNodeGeometry (AbstractGraphModel & graphModel)
1818 : AbstractNodeGeometry(graphModel)
1919 , _portSize(20 )
20- , _portSpasing(20 )
20+ , _portSpasing(10 )
2121 , _fontMetrics(QFont())
2222 , _boldFontMetrics(QFont())
2323{
@@ -29,22 +29,6 @@ DefaultHorizontalNodeGeometry(AbstractGraphModel & graphModel)
2929}
3030
3131
32- QRectF
33- DefaultHorizontalNodeGeometry::
34- boundingRect (NodeId const nodeId) const
35- {
36- QRect r (QPoint (0 , 0 ), size (nodeId));
37-
38- auto const & nodeStyle = StyleCollection::nodeStyle ();
39- double addon = 4 * nodeStyle.ConnectionPointDiameter ;
40-
41- return r.adjusted (-addon,
42- -addon,
43- +addon,
44- +addon);
45- }
46-
47-
4832QSize
4933DefaultHorizontalNodeGeometry::
5034size (NodeId const nodeId) const
@@ -68,10 +52,13 @@ recomputeSize(NodeId const nodeId) const
6852
6953 height += capRect.height ();
7054
55+ height += _portSpasing; // space above caption
56+ height += _portSpasing; // space below caption
57+
7158 unsigned int inPortWidth = maxPortsTextAdvance (nodeId, PortType::In);
7259 unsigned int outPortWidth = maxPortsTextAdvance (nodeId, PortType::Out);
7360
74- unsigned int width = inPortWidth + outPortWidth + 2 * _portSpasing;
61+ unsigned int width = inPortWidth + outPortWidth + 4 * _portSpasing;
7562
7663 if (auto w = _graphModel.nodeData <QWidget*>(nodeId, NodeRole::Widget))
7764 {
@@ -101,6 +88,7 @@ portPosition(NodeId const nodeId,
10188 double totalHeight = 0.0 ;
10289
10390 totalHeight += captionRect (nodeId).height ();
91+ totalHeight += _portSpasing;
10492
10593 totalHeight += step * portIndex;
10694 totalHeight += step / 2.0 ;
@@ -111,15 +99,17 @@ portPosition(NodeId const nodeId,
11199 {
112100 case PortType::In:
113101 {
114- double x = 0.0 - nodeStyle.ConnectionPointDiameter ;
102+ // double x = 0.0 - nodeStyle.ConnectionPointDiameter;
103+ double x = 0.0 ;
115104
116105 result = QPointF (x, totalHeight);
117106 break ;
118107 }
119108
120109 case PortType::Out:
121110 {
122- double x = size.width () + nodeStyle.ConnectionPointDiameter ;
111+ // double x = size.width() + nodeStyle.ConnectionPointDiameter;
112+ double x = size.width ();
123113
124114 result = QPointF (x, totalHeight);
125115 break ;
@@ -151,11 +141,13 @@ portTextPosition(NodeId const nodeId,
151141 switch (portType)
152142 {
153143 case PortType::In:
154- p.setX (5.0 );
144+ p.setX (_portSpasing);
145+ // p.setX(5.0);
155146 break ;
156147
157148 case PortType::Out:
158- p.setX (size.width () - 5.0 - rect.width ());
149+ // p.setX(size.width() - 5.0 - rect.width());
150+ p.setX (size.width () - _portSpasing - rect.width ());
159151 break ;
160152
161153 default :
@@ -187,7 +179,7 @@ captionPosition(NodeId const nodeId) const
187179{
188180 QSize size = _graphModel.nodeData <QSize>(nodeId, NodeRole::Size);
189181 return QPointF (0.5 * (size.width () - captionRect (nodeId).width ()),
190- 0.5 * _portSpasing);
182+ 0.5 * _portSpasing + captionRect (nodeId). height () );
191183}
192184
193185
@@ -222,13 +214,13 @@ QRect
222214DefaultHorizontalNodeGeometry::
223215resizeHandleRect (NodeId const nodeId) const
224216{
225- QSize size = _graphModel.nodeData <QSize>(nodeId,
217+ QSize size = _graphModel.nodeData <QSize>(nodeId,
226218 NodeRole::Size);
227219
228220 unsigned int rectSize = 7 ;
229221
230- return QRect (size.width () - rectSize ,
231- size.height () - rectSize ,
222+ return QRect (size.width () - _portSpasing ,
223+ size.height () - _portSpasing ,
232224 rectSize,
233225 rectSize);
234226}
0 commit comments