Allow painting of arbitrary number of connection slots.

This commit is contained in:
dfighter1985 2014-09-14 16:57:56 +02:00
parent eb70ac6199
commit c404e0e590
2 changed files with 8 additions and 3 deletions

View file

@ -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 );

View file

@ -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;