|
|
|
@ -40,6 +40,7 @@ QRectF ExpressionNode::boundingRect() const
|
|
|
|
|
void ExpressionNode::paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget )
|
|
|
|
|
{
|
|
|
|
|
QBrush br;
|
|
|
|
|
QBrush boxBrush;
|
|
|
|
|
QPen p;
|
|
|
|
|
QColor c;
|
|
|
|
|
|
|
|
|
@ -62,7 +63,6 @@ void ExpressionNode::paint( QPainter *painter, const QStyleOptionGraphicsItem *o
|
|
|
|
|
painter->setPen( p );
|
|
|
|
|
painter->drawText( header, Qt::AlignCenter, "Something" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( option->state & QStyle::State_Selected )
|
|
|
|
|
{
|
|
|
|
|
p.setStyle( Qt::DotLine );
|
|
|
|
@ -73,6 +73,8 @@ void ExpressionNode::paint( QPainter *painter, const QStyleOptionGraphicsItem *o
|
|
|
|
|
painter->setPen( p );
|
|
|
|
|
painter->drawRect( rect );
|
|
|
|
|
painter->drawRect( header );
|
|
|
|
|
|
|
|
|
|
paintConnections( painter );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -84,4 +86,55 @@ void ExpressionNode::mouseMoveEvent( QGraphicsSceneMouseEvent *e )
|
|
|
|
|
QGraphicsItem::mouseMoveEvent( e );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExpressionNode::paintConnections( QPainter *painter )
|
|
|
|
|
{
|
|
|
|
|
QRectF rect = boundingRect();
|
|
|
|
|
QBrush boxBrush;
|
|
|
|
|
QPen p;
|
|
|
|
|
|
|
|
|
|
boxBrush.setColor( Qt::black );
|
|
|
|
|
boxBrush.setStyle( Qt::SolidPattern );
|
|
|
|
|
p.setColor( Qt::black );
|
|
|
|
|
|
|
|
|
|
QRectF box = rect;
|
|
|
|
|
QRectF tbox = rect;
|
|
|
|
|
qreal wh = 10.0;
|
|
|
|
|
qreal tw = 25.0;
|
|
|
|
|
qreal th = 12.0;
|
|
|
|
|
|
|
|
|
|
box.setTopLeft( QPoint( 0, rect.height() * 0.5 ) );
|
|
|
|
|
box.setHeight( wh );
|
|
|
|
|
box.setWidth( wh );
|
|
|
|
|
|
|
|
|
|
painter->fillRect( box, boxBrush );
|
|
|
|
|
|
|
|
|
|
tbox.setTopLeft( QPoint( 15, rect.height() * 0.50 ) );
|
|
|
|
|
tbox.setHeight( th );
|
|
|
|
|
tbox.setWidth( tw );
|
|
|
|
|
painter->setPen( p );
|
|
|
|
|
painter->drawText( tbox, Qt::AlignCenter, "Out" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for( int i = 0; i < 3; i++ )
|
|
|
|
|
{
|
|
|
|
|
qreal x = rect.width() - wh;
|
|
|
|
|
qreal y = 30 + i * 20;
|
|
|
|
|
qreal tx = x - 5 - tw;
|
|
|
|
|
qreal ty = y - 2;
|
|
|
|
|
|
|
|
|
|
box.setTopLeft( QPoint( x, y ) );
|
|
|
|
|
box.setHeight( wh );
|
|
|
|
|
box.setWidth( wh );
|
|
|
|
|
|
|
|
|
|
painter->fillRect( box, boxBrush );
|
|
|
|
|
|
|
|
|
|
tbox.setTopLeft( QPoint( tx, ty ) );
|
|
|
|
|
tbox.setHeight( th );
|
|
|
|
|
tbox.setWidth( tw );
|
|
|
|
|
|
|
|
|
|
QString text = 'A' + i;
|
|
|
|
|
painter->drawText( tbox, Qt::AlignRight, text );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|