- painter->setMatrixEnabled(false);
- QLineF guideline = painter->matrix().map(line());
- painter->setPen(pen());
- painter->drawLine(guideline);
- //painter->fillRect(painter->matrix().mapRect(boundingRect()), QColor(200, 100, 100, 100));
- //QGraphicsLineItem::paint(painter, option, w);
- if (KdenliveSettings::showmarkers()) {
- QPointF p1 = guideline.p1() + QPointF(1, 0);
- QRectF txtBounding = painter->boundingRect(p1.x(), p1.y() + 10, m_width, 50, Qt::AlignLeft | Qt::AlignTop, ' ' + m_label + ' ');
- QPainterPath path;
- path.addRoundedRect(txtBounding, 3, 3);
- painter->fillPath(path, QBrush(pen().color()));
+ QGraphicsLineItem::paint(painter, option);
+ if (KdenliveSettings::showmarkers() && scene() && scene()->views().count()) {
+ QPointF p1 = line().p1();
+ const QFontMetrics metric = m_view->fontMetrics();
+ painter->setClipRect(option->rect);
+ // makes sure the text stays visible when scrolling vertical
+ int offset = scene()->views()[0]->verticalScrollBar()->value();
+
+ QRectF txtBounding = painter->boundingRect(p1.x(), p1.y() + offset, m_width, metric.height(), Qt::AlignLeft | Qt::AlignTop, m_label);
+ painter->setBrush(QBrush(m_pen.color()));
+ painter->drawRoundedRect(txtBounding.adjusted(-5, -5, 2, 1), 3, 3);