tuchulcha  0.10.1
Graphical Workflow Configuration Editor
ConnectionLine.h
Go to the documentation of this file.
1 /* Copyright (C) 2011 Jonathan Wuest
2 
3  This file is part of Tuchulcha.
4 
5  Tuchulcha is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  Tuchulcha is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with Tuchulcha. If not, see <http://www.gnu.org/licenses/>.
17 */
24 #ifndef CONNECTIONLINE_H_
25 #define CONNECTIONLINE_H_
26 
27 #include <QGraphicsItem>
28 #include <QPointF>
29 
30 
31 class NodeProperty;
32 class Node;
33 
35 class ConnectionLine : public QGraphicsItem {
37  Q_PROPERTY(QColor lineColor READ lineColor WRITE setLineColor)
38 
39 public:
42 
44  QRectF boundingRect() const;
45 
49  void setStartPoint(int x,int y);
50 
53  void setStartPoint(QPointF pos);
54 
58  void setEndPoint(int x,int y);
59 
62  void setEndPoint(QPointF pos);
63 
67  void setStartEndProp(NodeProperty *start,NodeProperty *end);
68 
70  void paint(
71  QPainter *painter, const QStyleOptionGraphicsItem *option,
72  QWidget *widget = 0);
73 
76  NodeProperty *getEndProp() const;
77 
80  NodeProperty *getStartProp() const;
81 
84  void setEndProp(NodeProperty *endProp);
85 
88  void setStartProp(NodeProperty *startProp);
89 
93  void moveStartPoint(qreal dx,qreal dy);
94 
98  void moveEndPoint(qreal dx,qreal dy);
99 
101  void setLineColor(const QColor &newColor);
102 
104  QColor lineColor() const;
105 
106 private:
108  QPointF _startPoint;
109 
111  QPointF _endPoint;
112 
115 
118 
120  QColor _lColor;
121 
122 };
123 
124 #endif /* CONNECTIONLINE_H_ */
QPointF _startPoint
point where line starts
void setEndProp(NodeProperty *endProp)
sets end property
QGraphicsItem that contains nodeproperties and draws the node.
Definition: Node.h:36
NodeProperty * getEndProp() const
get property at end of line
QColor _lColor
store color
NodeProperty * getStartProp() const
get property at start of line
NodeProperty * _endProp
property where line ends
void setLineColor(const QColor &newColor)
set color connected line
NodeProperty * _startProp
property where line starts
QPointF _endPoint
point where line ends
QRectF boundingRect() const
bounding Rect, always 0 to be not selectable
void setStartProp(NodeProperty *startProp)
sets start property
void setStartPoint(int x, int y)
sets start point (for drawing)
void moveEndPoint(qreal dx, qreal dy)
moves end point
Line that connects two slots of two different nodes.
void moveStartPoint(qreal dx, qreal dy)
moves start point
Property(/Parameter) of a node.
Definition: NodeProperty.h:35
ConnectionLine()
Default constructor.
void setStartEndProp(NodeProperty *start, NodeProperty *end)
sets start and end property
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
paints the line
QColor lineColor() const
return line color
void setEndPoint(int x, int y)
sets end point (for drawing)