mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-20 16:08:44 +00:00
Add a little style.
--HG-- branch : dfighter-tools
This commit is contained in:
parent
af550acd62
commit
aef69eef64
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