moved some timelineview functions into a timelineviewbase for reusing

Later classes will feature similar functionality to the TimelineView, moving
them to a base class that can be easily reused seems like a good idea.
This commit is contained in:
itsmattkc
2019-12-25 02:20:23 +11:00
parent dc6d498da8
commit 4b48a73db3
7 changed files with 163 additions and 73 deletions
@@ -20,17 +20,14 @@
#include "timelineplayhead.h"
TimelinePlayhead::TimelinePlayhead()
{
#include <QPainter>
}
QColor TimelinePlayhead::PlayheadColor()
const QColor &TimelinePlayhead::PlayheadColor() const
{
return playhead_color_;
}
QColor TimelinePlayhead::PlayheadHighlightColor()
const QColor &TimelinePlayhead::PlayheadHighlightColor() const
{
return playhead_highlight_color_;
}
@@ -44,3 +41,14 @@ void TimelinePlayhead::SetPlayheadHighlightColor(QColor c)
{
playhead_highlight_color_ = c;
}
void TimelinePlayhead::Draw(QPainter* painter, const QRectF& playhead_rect) const
{
painter->setPen(Qt::NoPen);
painter->setBrush(PlayheadHighlightColor());
painter->drawRect(playhead_rect);
painter->setPen(PlayheadColor());
painter->setBrush(Qt::NoBrush);
painter->drawLine(QLineF(playhead_rect.topLeft(), playhead_rect.bottomLeft()));
}