X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fguide.cpp;h=ba05ec6aef126841aa744ae0cbe494b013b5c1d9;hb=c3302003093710ee247ad84c0fe2ef3c579d417f;hp=9c92236bd44f59103aa3879f755b94c024a33dde;hpb=115a60d9e3e994e981d9db85e77c35d34dbc6a36;p=kdenlive diff --git a/src/guide.cpp b/src/guide.cpp index 9c92236b..ba05ec6a 100644 --- a/src/guide.cpp +++ b/src/guide.cpp @@ -29,7 +29,7 @@ #include #include -Guide::Guide(CustomTrackView *view, GenTime pos, QString label, double height) : +Guide::Guide(CustomTrackView *view, const GenTime &pos, const QString &label, double height) : QGraphicsLineItem(), m_position(pos), m_label(label), @@ -70,7 +70,7 @@ CommentedTime Guide::info() const return CommentedTime(m_position, m_label); } -void Guide::updateGuide(const GenTime newPos, const QString &comment) +void Guide::updateGuide(const GenTime &newPos, const QString &comment) { m_position = newPos; setPos(m_position.frames(m_view->fps()), 0); @@ -158,18 +158,13 @@ void Guide::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWi 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); - // draw the text on a rect with a arc appended - QPainterPath path; - path.moveTo(txtBounding.bottomRight()); - path.arcTo(txtBounding.right() - txtBounding.height() - 2, txtBounding.top() - txtBounding.height(), txtBounding.height() * 2, txtBounding.height() * 2, 270, 90); - path.lineTo(txtBounding.topLeft()); - path.lineTo(txtBounding.bottomLeft()); - painter->fillPath(path, m_pen.color()); + painter->setBrush(QBrush(m_pen.color())); + painter->drawRoundedRect(txtBounding.adjusted(-5, -5, 2, 1), 3, 3); painter->setPen(Qt::white); painter->drawText(txtBounding.adjusted(1, 0, 1, 0), Qt::AlignCenter, m_label); }