1 // Ryzom Core Studio - GUI Editor Plugin
3 // Copyright (C) 2010-2014 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Affero General Public License as
7 // published by the Free Software Foundation, either version 3 of the
8 // License, or (at your option) any later version.
10 // This program 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 Affero General Public License for more details.
15 // You should have received a copy of the GNU Affero General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include "expression_link.h"
19 #include "expression_node.h"
20 #include <QGraphicsItem>
23 ExpressionLink::ExpressionLink( QGraphicsItem
*parent
) :
24 QGraphicsLineItem( parent
)
30 ExpressionLink::~ExpressionLink()
35 void ExpressionLink::link( ExpressionNode
*from
, ExpressionNode
*to
, int fromSlot
, int toSlot
)
39 m_from
->setLink( this, fromSlot
);
40 m_to
->setLink( this, toSlot
);
42 m_fromSlot
= fromSlot
;
48 void ExpressionLink::unlink()
53 m_from
->setLink( NULL
, m_fromSlot
);
54 m_to
->setLink( NULL
, m_toSlot
);
62 void ExpressionLink::nodeMoved()
64 setLine( QLineF( m_from
->slotPos( m_fromSlot
), m_to
->slotPos( m_toSlot
) ) );
67 void ExpressionLink::paint( QPainter
*painter
, const QStyleOptionGraphicsItem
*option
, QWidget
*widget
)
70 p
.setColor( Qt::black
);
74 QGraphicsLineItem::paint( painter
, option
, widget
);