use raw time values independent of timebase for scaling timeline ui
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
#include "timelineviewplayheaditem.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QGraphicsScene>
|
||||
#include <QPainter>
|
||||
#include <QtMath>
|
||||
|
||||
TimelineViewPlayheadItem::TimelineViewPlayheadItem(QGraphicsItem *parent) :
|
||||
TimelineViewRect(parent)
|
||||
TimelineViewRect(parent),
|
||||
playhead_(0)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -17,6 +19,13 @@ void TimelineViewPlayheadItem::SetPlayhead(const int64_t &playhead)
|
||||
UpdateRect();
|
||||
}
|
||||
|
||||
void TimelineViewPlayheadItem::SetTimebase(const rational &timebase)
|
||||
{
|
||||
timebase_ = timebase;
|
||||
|
||||
UpdateRect();
|
||||
}
|
||||
|
||||
void TimelineViewPlayheadItem::UpdateRect()
|
||||
{
|
||||
double x = TimeToScreenCoord(rational(playhead_ * timebase_.numerator(), timebase_.denominator()));
|
||||
@@ -33,10 +42,10 @@ void TimelineViewPlayheadItem::paint(QPainter *painter, const QStyleOptionGraphi
|
||||
|
||||
// FIXME: Make adjustable through CSS
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->setBrush(QColor(255, 255, 255, 128));
|
||||
painter->setBrush(style_.PlayheadHighlightColor());
|
||||
painter->drawRect(rect());
|
||||
|
||||
painter->setPen(Qt::red);
|
||||
painter->setPen(style_.PlayheadColor());
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
painter->drawLine(QLineF(rect().topLeft(), rect().bottomLeft()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user