More refactoring.
This commit is contained in:
parent
e9515a4ee0
commit
ab163ff063
1 changed files with 28 additions and 9 deletions
|
@ -24,9 +24,23 @@
|
||||||
|
|
||||||
struct NodeSlotInfo
|
struct NodeSlotInfo
|
||||||
{
|
{
|
||||||
|
// top-left
|
||||||
QPoint tl;
|
QPoint tl;
|
||||||
|
|
||||||
|
// text top-left
|
||||||
QPoint ttl;
|
QPoint ttl;
|
||||||
|
|
||||||
|
// The text displayed
|
||||||
QString text;
|
QString text;
|
||||||
|
|
||||||
|
// text width
|
||||||
|
qreal tw;
|
||||||
|
|
||||||
|
// text height
|
||||||
|
qreal th;
|
||||||
|
|
||||||
|
// width-height of the box
|
||||||
|
qreal wh;
|
||||||
};
|
};
|
||||||
|
|
||||||
class NodeSlot
|
class NodeSlot
|
||||||
|
@ -38,9 +52,9 @@ public:
|
||||||
m_ttl = info.ttl;
|
m_ttl = info.ttl;
|
||||||
m_text = info.text;
|
m_text = info.text;
|
||||||
|
|
||||||
m_tw = 25.0;
|
m_tw = info.tw;
|
||||||
m_th = 12.0;
|
m_th = info.th;
|
||||||
m_wh = 10.0;
|
m_wh = info.wh;
|
||||||
}
|
}
|
||||||
|
|
||||||
~NodeSlot()
|
~NodeSlot()
|
||||||
|
@ -177,12 +191,17 @@ void ExpressionNode::mouseMoveEvent( QGraphicsSceneMouseEvent *e )
|
||||||
void ExpressionNode::createSlots()
|
void ExpressionNode::createSlots()
|
||||||
{
|
{
|
||||||
// First create the "Out" slot
|
// First create the "Out" slot
|
||||||
qreal x = 0.0;
|
|
||||||
qreal y = m_h * 0.5;
|
|
||||||
qreal tx = 10;
|
|
||||||
qreal ty = m_h * 0.5 - 2;
|
|
||||||
|
|
||||||
NodeSlotInfo info;
|
NodeSlotInfo info;
|
||||||
|
info.tw = 25.0;
|
||||||
|
info.th = 12.0;
|
||||||
|
info.wh = 10.0;
|
||||||
|
|
||||||
|
qreal x = 0.0;
|
||||||
|
qreal y = m_h * 0.5;
|
||||||
|
qreal tx = info.wh;
|
||||||
|
qreal ty = m_h * 0.5 - 2;
|
||||||
|
|
||||||
info.tl = QPoint( x, y );
|
info.tl = QPoint( x, y );
|
||||||
info.ttl = QPoint( tx, ty );
|
info.ttl = QPoint( tx, ty );
|
||||||
info.text = "Out";
|
info.text = "Out";
|
||||||
|
@ -192,9 +211,9 @@ void ExpressionNode::createSlots()
|
||||||
// Then the rest of them
|
// Then the rest of them
|
||||||
for( int i = 0; i < 3; i++ )
|
for( int i = 0; i < 3; i++ )
|
||||||
{
|
{
|
||||||
x = m_w - 10;
|
x = m_w - info.wh;
|
||||||
y = 30 + i * 20.0;
|
y = 30 + i * 20.0;
|
||||||
tx = x - 5 - 25.0;
|
tx = x - 5 - info.tw;
|
||||||
ty = y - 2;
|
ty = y - 2;
|
||||||
|
|
||||||
info.tl = QPoint( x, y );
|
info.tl = QPoint( x, y );
|
||||||
|
|
Loading…
Reference in a new issue