From 035f824a9390a7d373a431b950a782321b08ec4b Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sun, 14 Sep 2014 16:57:56 +0200 Subject: [PATCH] Allow painting of arbitrary number of connection slots. --- code/studio/src/plugins/gui_editor/expression_node.cpp | 6 +++++- code/studio/src/plugins/gui_editor/expression_node.h | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/code/studio/src/plugins/gui_editor/expression_node.cpp b/code/studio/src/plugins/gui_editor/expression_node.cpp index 86469314a..c12ca3ea5 100644 --- a/code/studio/src/plugins/gui_editor/expression_node.cpp +++ b/code/studio/src/plugins/gui_editor/expression_node.cpp @@ -102,6 +102,10 @@ QGraphicsItem( parent ) { m_w = 100; m_h = 100; + m_hh = 20.0; + + if( slotCount > 3 ) + m_h = m_h + 20.0 * ( slotCount - 3 ); createSlots( slotCount ); } @@ -128,7 +132,7 @@ void ExpressionNode::paint( QPainter *painter, const QStyleOptionGraphicsItem *o QRectF rect = boundingRect(); QRectF header = rect; - header.setHeight( header.height() * 0.2 ); + header.setHeight( m_hh ); // Draw filled rectangle, header c.setRed( 44 ); diff --git a/code/studio/src/plugins/gui_editor/expression_node.h b/code/studio/src/plugins/gui_editor/expression_node.h index 654329dd5..6df38d583 100644 --- a/code/studio/src/plugins/gui_editor/expression_node.h +++ b/code/studio/src/plugins/gui_editor/expression_node.h @@ -56,8 +56,9 @@ private: void createSlots( int count = 3 ); void paintSlots( QPainter *painter ); - qreal m_w; - qreal m_h; + qreal m_w; // node width + qreal m_h; // node height + qreal m_hh; // header height QList< NodeSlot* > m_slots; QList< ExpressionLink* > m_links;