Commit b4fcb670 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

GrpahicsTracks: Implementing the setEmphasized method.

parent 8a8503f7
......@@ -29,7 +29,8 @@
GraphicsTrack::GraphicsTrack( Workflow::TrackType type, quint32 trackNumber,
QGraphicsItem *parent ) :
QGraphicsWidget( parent )
QGraphicsWidget( parent ),
m_emphasizer( NULL )
{
m_type = type;
m_trackNumber = trackNumber;
......@@ -110,7 +111,34 @@ GraphicsTrack::trackWorkflow()
}
void
GraphicsTrack::setEmphasized( bool )
GraphicsTrack::setEmphasized( bool value )
{
//TODO
if ( m_emphasizer == NULL )
m_emphasizer = new EmphasizedTrackItem( this, maximumWidth(), preferredHeight() );
if ( value == true )
m_emphasizer->show();
else
m_emphasizer->hide();
}
EmphasizedTrackItem::EmphasizedTrackItem( GraphicsTrack *parent, qreal width, qreal height ) :
QGraphicsItem( parent ),
m_width( width ),
m_height( height )
{
}
QRectF
EmphasizedTrackItem::boundingRect() const
{
return QRectF( 0, 0, m_width, m_height );
}
void
EmphasizedTrackItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget)
{
painter->setBrush( QBrush( Qt::darkBlue ));
painter->drawRect( boundingRect() );
}
......@@ -57,6 +57,18 @@ private:
quint32 m_trackNumber;
bool m_enabled;
TrackWorkflow *m_trackWorkflow;
QGraphicsItem *m_emphasizer;
};
class EmphasizedTrackItem : public QGraphicsItem
{
public:
EmphasizedTrackItem( GraphicsTrack *parent, qreal width, qreal height );
QRectF boundingRect() const;
void paint( QPainter*, const QStyleOptionGraphicsItem*, QWidget* );
private:
qreal m_width;
qreal m_height;
};
#endif // GRAPHICSTRACK_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment