From d0843e7a75da32bfdf62bc02366bb40cbbea0819 Mon Sep 17 00:00:00 2001 From: Alberto Villa Date: Tue, 12 May 2009 00:38:14 +0000 Subject: [PATCH] - fix guides width being smaller when just added - make the guides label clickable: http://www.kdenlive.org/mantis/view.php?id=785 svn path=/trunk/kdenlive/; revision=3376 --- src/guide.cpp | 15 ++++++++++++++- src/guide.h | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/guide.cpp b/src/guide.cpp index b6c05a43..08e5e9ef 100644 --- a/src/guide.cpp +++ b/src/guide.cpp @@ -38,7 +38,7 @@ Guide::Guide(CustomTrackView *view, GenTime pos, QString label, double fps, doub setToolTip(label); setLine(0, 0, 0, height); setPos(m_position.frames(m_fps), 0); - setPen(QPen(QBrush(QColor(0, 0, 200, 180)), 1)); + setPen(QPen(QBrush(QColor(0, 0, 200, 180)), 2)); setZValue(999); setAcceptsHoverEvents(true); const QFontMetrics metric = m_view->fontMetrics(); @@ -116,6 +116,19 @@ QRectF Guide::boundingRect() const } else return QGraphicsLineItem::boundingRect(); } +// virtual +QPainterPath Guide::shape() const +{ + QPainterPath path; + path.addRect(line().x1(), line().y1(), line().x2() - line().x1(), line().y2() - line().y1()); + if (KdenliveSettings::showmarkers()) { + const QFontMetrics metric = m_view->fontMetrics(); + int height = metric.height(); + path.addRoundedRect(line().x1(), line().y1() + 10, m_width / static_cast (scene())->scale(), height, 3, 3); + } + return path; +} + // virtual void Guide::paint(QPainter *painter, const QStyleOptionGraphicsItem */*option*/, QWidget */*w*/) { diff --git a/src/guide.h b/src/guide.h index e777e001..dc455a59 100644 --- a/src/guide.h +++ b/src/guide.h @@ -41,6 +41,7 @@ public: virtual int type() const; virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *w); virtual QRectF boundingRect() const; + virtual QPainterPath shape() const; protected: virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *); -- 2.39.2