]> git.sesse.net Git - kdenlive/commitdiff
Small repaint cleanup
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 14 Apr 2009 21:09:57 +0000 (21:09 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 14 Apr 2009 21:09:57 +0000 (21:09 +0000)
svn path=/trunk/kdenlive/; revision=3304

src/clipitem.cpp
src/customtrackview.cpp

index 3c0ebdb8a8467c9251f8424954b4a857d1c38312..db222a1df2077fcb6548a5a222320f7209bcf9e4 100644 (file)
@@ -626,9 +626,9 @@ void ClipItem::paint(QPainter *painter,
     painter->setClipRect(exposed);
 
     //Fill clip rectangle
-    QRectF bgRect = br;
-    bgRect.setLeft(br.left() + xoffset);
-    painter->fillRect(bgRect, paintColor);
+    /*QRectF bgRect = br;
+    bgRect.setLeft(br.left() + xoffset);*/
+    painter->fillRect(exposed, paintColor);
 
     //painter->setClipPath(resultClipPath, Qt::IntersectClip);
 
@@ -792,7 +792,6 @@ void ClipItem::paint(QPainter *painter,
     }
 
     // Draw clip name
-    // draw frame around clip
     QColor frameColor(Qt::black);
     int alphaBase = 60;
     if (isSelected() || (parentItem() && parentItem()->isSelected())) {
index fe33b3c4ea9d5f2dcda6cb9effa918e9efa86ac4..8a72b6d3a901effb70d8fa14df9b8f5e8415d7fd 100644 (file)
@@ -263,15 +263,13 @@ void CustomTrackView::slotCheckPositionScrolling()
 {
     // If mouse is at a border of the view, scroll
     if (m_moveOpMode != SEEK) return;
-    int pos = cursorPos();
-    if (mapFromScene(pos, 0).x() < 7) {
+    if (mapFromScene(m_cursorPos, 0).x() < 3) {
         horizontalScrollBar()->setValue(horizontalScrollBar()->value() - 2);
-        setCursorPos(mapToScene(QPoint()).x() - 1);
         QTimer::singleShot(200, this, SLOT(slotCheckPositionScrolling()));
-
-    } else if (viewport()->width() - 5 < mapFromScene(pos + 1, 0).x()) {
+        setCursorPos(mapToScene(QPoint(-2, 0)).x());
+    } else if (viewport()->width() - 3 < mapFromScene(m_cursorPos + 1, 0).x()) {
         horizontalScrollBar()->setValue(horizontalScrollBar()->value() + 2);
-        setCursorPos(mapToScene(viewport()->width(), 0).x() + 1);
+        setCursorPos(mapToScene(QPoint(viewport()->width(), 0)).x() + 1);
         QTimer::singleShot(200, this, SLOT(slotCheckPositionScrolling()));
     }
 }
@@ -541,11 +539,6 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event)
         m_moveOpMode = opMode;
         setCursor(Qt::SplitHCursor);
     } else {
-        if (event->buttons() != Qt::NoButton && event->modifiers() == Qt::NoModifier) {
-            m_moveOpMode = SEEK;
-            setCursorPos(mappedXPos);
-            slotCheckPositionScrolling();
-        } else m_moveOpMode = NONE;
         if (m_visualTip) {
             delete m_animation;
             m_animationTimer->stop();
@@ -555,6 +548,13 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event)
 
         }
         setCursor(Qt::ArrowCursor);
+        if (event->buttons() != Qt::NoButton && event->modifiers() == Qt::NoModifier) {
+            QGraphicsView::mouseMoveEvent(event);
+            m_moveOpMode = SEEK;
+            setCursorPos(mappedXPos);
+            slotCheckPositionScrolling();
+            return;
+        } else m_moveOpMode = NONE;
     }
     QGraphicsView::mouseMoveEvent(event);
 }
@@ -2070,9 +2070,9 @@ void CustomTrackView::setCursorPos(int pos, bool seek)
     if (pos == m_cursorPos) return;
     emit cursorMoved((int)(m_cursorPos), (int)(pos));
     m_cursorPos = pos;
-    m_cursorLine->setPos(pos, 0);
-    if (seek) m_document->renderer()->seek(GenTime(pos, m_document->fps()));
+    if (seek) m_document->renderer()->seek(GenTime(m_cursorPos, m_document->fps()));
     else if (m_autoScroll) checkScrolling();
+    m_cursorLine->setPos(m_cursorPos, 0);
 }
 
 void CustomTrackView::updateCursorPos()
@@ -2104,9 +2104,7 @@ void CustomTrackView::initCursorPos(int pos)
 
 void CustomTrackView::checkScrolling()
 {
-    int vert = verticalScrollBar()->value();
-    int hor = cursorPos();
-    ensureVisible(hor, vert + 10, 2, 2, 50, 0);
+    ensureVisible(m_cursorPos, verticalScrollBar()->value() + 10, 2, 2, 50, 0);
 }
 
 void CustomTrackView::mouseReleaseEvent(QMouseEvent * event)