Allow painting of arbitrary number of connection slots.

--HG--
branch : dfighter-tools
This commit is contained in:
dfighter1985 2014-09-14 16:57:56 +02:00
parent 40b4bce729
commit 99ebe16c03
2 changed files with 8 additions and 3 deletions

View file

@ -102,6 +102,10 @@ QGraphicsItem( parent )
{ {
m_w = 100; m_w = 100;
m_h = 100; m_h = 100;
m_hh = 20.0;
if( slotCount > 3 )
m_h = m_h + 20.0 * ( slotCount - 3 );
createSlots( slotCount ); createSlots( slotCount );
} }
@ -128,7 +132,7 @@ void ExpressionNode::paint( QPainter *painter, const QStyleOptionGraphicsItem *o
QRectF rect = boundingRect(); QRectF rect = boundingRect();
QRectF header = rect; QRectF header = rect;
header.setHeight( header.height() * 0.2 ); header.setHeight( m_hh );
// Draw filled rectangle, header // Draw filled rectangle, header
c.setRed( 44 ); c.setRed( 44 );

View file

@ -56,8 +56,9 @@ private:
void createSlots( int count = 3 ); void createSlots( int count = 3 );
void paintSlots( QPainter *painter ); void paintSlots( QPainter *painter );
qreal m_w; qreal m_w; // node width
qreal m_h; qreal m_h; // node height
qreal m_hh; // header height
QList< NodeSlot* > m_slots; QList< NodeSlot* > m_slots;
QList< ExpressionLink* > m_links; QList< ExpressionLink* > m_links;