]> git.sesse.net Git - kdenlive/commitdiff
Fix moving guide bug
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 4 Feb 2013 18:02:49 +0000 (19:02 +0100)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 4 Feb 2013 18:03:29 +0000 (19:03 +0100)
src/customtrackview.cpp
src/guide.cpp

index c4563bfc6b1edf8953e0f9f1c6690e87524802c5..30e6b13da9d67f7546911085c3352b11906f9a23 100644 (file)
@@ -324,12 +324,9 @@ bool CustomTrackView::checkTrackHeight()
         }
     }
     double newHeight = m_tracksHeight * m_document->tracksCount() * matrix().m22();
-    m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), newHeight - 1);
-
+    m_cursorLine->setLine(0, 0, 0, newHeight - 1);
     for (int i = 0; i < m_guides.count(); i++) {
-        QLineF l = m_guides.at(i)->line();
-        l.setP2(QPointF(l.x2(), newHeight));
-        m_guides.at(i)->setLine(l);
+        m_guides.at(i)->setLine(0, 0, 0, newHeight - 1);
     }
 
     setSceneRect(0, 0, sceneRect().width(), m_tracksHeight * m_document->tracksCount());
@@ -3076,12 +3073,10 @@ void CustomTrackView::addTrack(TrackInfo type, int ix)
 
     int maxHeight = m_tracksHeight * m_document->tracksCount() * matrix().m22();
     for (int i = 0; i < m_guides.count(); i++) {
-        QLineF l = m_guides.at(i)->line();
-        l.setP2(QPointF(l.x2(), maxHeight));
-        m_guides.at(i)->setLine(l);
+        m_guides.at(i)->setLine(0, 0, 0, maxHeight - 1);
     }
 
-    m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), maxHeight - 1);
+    m_cursorLine->setLine(0, 0, 0, maxHeight - 1);
     setSceneRect(0, 0, sceneRect().width(), m_tracksHeight * m_document->tracksCount());
     viewport()->update();
     //QTimer::singleShot(500, this, SIGNAL(trackHeightChanged()));
@@ -3151,11 +3146,9 @@ void CustomTrackView::removeTrack(int ix)
 
     int maxHeight = m_tracksHeight * m_document->tracksCount() * matrix().m22();
     for (int i = 0; i < m_guides.count(); i++) {
-        QLineF l = m_guides.at(i)->line();
-        l.setP2(QPointF(l.x2(), maxHeight));
-        m_guides.at(i)->setLine(l);
+        m_guides.at(i)->setLine(0, 0, 0, maxHeight - 1);
     }
-    m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), maxHeight - 1);
+    m_cursorLine->setLine(0, 0, 0, maxHeight - 1);
     setSceneRect(0, 0, sceneRect().width(), m_tracksHeight * m_document->tracksCount());
 
     m_selectedTrack = qMin(m_selectedTrack, m_document->tracksCount() - 1);
@@ -3658,6 +3651,7 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event)
         }
         m_dragGuide = NULL;
         m_dragItem = NULL;
+       QGraphicsView::mouseReleaseEvent(event);
         return;
     } else if (m_operationMode == SPACER && m_selectionGroup) {
         int track;
@@ -5834,11 +5828,9 @@ void CustomTrackView::setScale(double scaleFactor, double verticalScale)
     setMatrix(newmatrix);
     if (adjust) {
         double newHeight = m_tracksHeight * m_document->tracksCount() * matrix().m22();
-        m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), newHeight - 1);
+       m_cursorLine->setLine(0, 0, 0, newHeight - 1);
         for (int i = 0; i < m_guides.count(); i++) {
-            QLineF l = m_guides.at(i)->line();
-            l.setP2(QPointF(l.x2(), newHeight));
-            m_guides.at(i)->setLine(l);
+            m_guides.at(i)->setLine(0, 0, 0, newHeight - 1);
         }
         setSceneRect(0, 0, sceneRect().width(), m_tracksHeight * m_document->tracksCount());
     }
index 47ba15e20a775508899cc7ea155242a7a358b764..d26358b48ab1e25a649e2f0b6bfac4923143f5bd 100644 (file)
@@ -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);
     }