From f170d8854b64d4b9102257e4cbe532b5ffdcef62 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 13 Sep 2014 18:03:02 +0200 Subject: [PATCH] Add a little style. --- .../plugins/gui_editor/expression_link.cpp | 2 +- .../plugins/gui_editor/expression_node.cpp | 35 ++++++++++++++++--- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/code/studio/src/plugins/gui_editor/expression_link.cpp b/code/studio/src/plugins/gui_editor/expression_link.cpp index 9fa6aa536..c17ad8b30 100644 --- a/code/studio/src/plugins/gui_editor/expression_link.cpp +++ b/code/studio/src/plugins/gui_editor/expression_link.cpp @@ -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 ); } diff --git a/code/studio/src/plugins/gui_editor/expression_node.cpp b/code/studio/src/plugins/gui_editor/expression_node.cpp index 8e92b6705..334fd3042 100644 --- a/code/studio/src/plugins/gui_editor/expression_node.cpp +++ b/code/studio/src/plugins/gui_editor/expression_node.cpp @@ -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 ); }