mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
Add a little style.
This commit is contained in:
parent
ac9dc5638c
commit
f170d8854b
2 changed files with 31 additions and 6 deletions
|
@ -58,7 +58,7 @@ void ExpressionLink::nodeMoved()
|
|||
|
||||
void ExpressionLink::paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget )
|
||||
{
|
||||
setPen( QPen( Qt::darkRed ) );
|
||||
setPen( QPen( Qt::black ) );
|
||||
|
||||
QGraphicsLineItem::paint( painter, option, widget );
|
||||
}
|
||||
|
|
|
@ -39,15 +39,40 @@ QRectF ExpressionNode::boundingRect() const
|
|||
|
||||
void ExpressionNode::paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget )
|
||||
{
|
||||
QBrush br;
|
||||
QPen p;
|
||||
QColor c;
|
||||
|
||||
QRectF rect = boundingRect();
|
||||
QRectF header = rect;
|
||||
header.setHeight( header.height() * 0.2 );
|
||||
|
||||
// Draw filled rectangle, header
|
||||
c.setRed( 44 );
|
||||
c.setGreen( 169 );
|
||||
c.setBlue( 232 );
|
||||
br.setColor( c );
|
||||
br.setStyle( Qt::SolidPattern );
|
||||
p.setColor( c );
|
||||
painter->setPen( p );
|
||||
painter->fillRect( header, br );
|
||||
|
||||
// Draw header text
|
||||
p.setColor( Qt::black );
|
||||
painter->setPen( p );
|
||||
painter->drawText( header, Qt::AlignCenter, "Something" );
|
||||
|
||||
|
||||
if( option->state & QStyle::State_Selected )
|
||||
{
|
||||
QPen outline;
|
||||
outline.setStyle( Qt::DotLine );
|
||||
painter->setPen( outline );
|
||||
|
||||
p.setStyle( Qt::DotLine );
|
||||
p.setColor( Qt::red );
|
||||
}
|
||||
|
||||
painter->drawRect( boundingRect() );
|
||||
// Draw outline of the entire thing + header
|
||||
painter->setPen( p );
|
||||
painter->drawRect( rect );
|
||||
painter->drawRect( header );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue