#include <QBrush>
#include <QStyleOptionGraphicsItem>
-Guide::Guide(CustomTrackView *view, GenTime pos, QString label, double fps, double height) :
+Guide::Guide(CustomTrackView *view, GenTime pos, QString label, double height) :
QGraphicsLineItem(),
m_position(pos),
m_label(label),
- m_fps(fps),
m_view(view),
m_pen(QPen())
{
- setFlags(QGraphicsItem::ItemIsMovable);
+ setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIgnoresTransformations);
setToolTip(label);
setLine(0, 0, 0, height);
- setPos(m_position.frames(m_fps), 0);
+ setPos(m_position.frames(m_view->fps()), 0);
m_pen.setWidthF(0);
m_pen.setColor(QColor(0, 0, 200, 180));
//m_pen.setCosmetic(true);
void Guide::updateGuide(const GenTime newPos, const QString &comment)
{
m_position = newPos;
- setPos(m_position.frames(m_fps), 0);
+ setPos(m_position.frames(m_view->fps()), 0);
if (!comment.isEmpty()) {
m_label = comment;
setToolTip(m_label);
}
}
+void Guide::updatePos()
+{
+ setPos(m_position.frames(m_view->fps()), 0);
+}
+
//virtual
int Guide::type() const
{
{
QGraphicsLineItem::paint(painter, option);
if (KdenliveSettings::showmarkers()) {
- painter->setMatrixEnabled(false);
- QPointF p1 = painter->matrix().map(line()).p1() + QPointF(1, 0);
+ QPointF p1 = line().p1() + QPointF(1, 0);
const QFontMetrics metric = m_view->fontMetrics();
QRectF txtBounding = painter->boundingRect(p1.x(), p1.y() + 10, m_width, metric.height(), Qt::AlignLeft | Qt::AlignTop, ' ' + m_label + ' ');
QPainterPath path;
painter->fillPath(path, m_pen.color());
painter->setPen(Qt::white);
painter->drawText(txtBounding, Qt::AlignCenter, m_label);
- painter->setMatrixEnabled(true);
}
}