]> git.sesse.net Git - kdenlive/blobdiff - src/transition.cpp
Make it easier to save render scripts with custom names: http://www.kdenlive.org...
[kdenlive] / src / transition.cpp
index 27f66cd65afafc9f7deab65b2601c6fe0ec80292..7fb3ca6b903c11a1162ddcbeac760cb95b9421fd 100644 (file)
@@ -161,22 +161,27 @@ void Transition::paint(QPainter *painter,
                        const QStyleOptionGraphicsItem *option,
                        QWidget */*widget*/)
 {
-    const QRectF exposed = option->exposedRect;
-    painter->setClipRect(exposed);
+    const QRectF exposed = painter->worldTransform().mapRect(option->exposedRect);
     const QRectF br = rect();
     QPen framePen;
+    framePen.setWidthF(1.2);
     const QRectF mapped = painter->worldTransform().mapRect(br);
 
-    painter->fillRect(exposed, brush());
-
     QPointF p1(br.x(), br.y() + br.height() / 2 - 7);
     painter->setWorldMatrixEnabled(false);
+    QPainterPath p;
+    p.addRect(exposed);
+    
+    QPainterPath q;
+    q.addRoundedRect(mapped, 3, 3);
+    painter->setClipPath(p.intersected(q));
+    painter->fillRect(exposed, brush());
     const QString text = m_name + (m_forceTransitionTrack ? "|>" : QString());
 
     // Draw clip name
     if (isSelected() || (parentItem() && parentItem()->isSelected())) {
-        framePen.setColor(Qt::red);
-        framePen.setWidthF(2.0);
+        framePen.setColor(scene()->palette().highlight().color());
+       framePen.setColor(Qt::red);
     }
     else {
         framePen.setColor(brush().color().darker());
@@ -184,7 +189,7 @@ void Transition::paint(QPainter *painter,
 
     const QRectF txtBounding = painter->boundingRect(mapped, Qt::AlignHCenter | Qt::AlignVCenter, ' ' + text + ' ');
     painter->setBrush(framePen.color());
-    painter->setPen(Qt::NoPen);
+    painter->setPen(framePen.color());
     painter->drawRoundedRect(txtBounding, 3, 3);
     painter->setBrush(QBrush(Qt::NoBrush));
 
@@ -194,7 +199,8 @@ void Transition::paint(QPainter *painter,
     // Draw frame
     painter->setPen(framePen);
     painter->setClipping(false);
-    painter->drawRect(mapped.adjusted(0, 0, -0.5, -0.5));
+    painter->setRenderHint(QPainter::Antialiasing, true);
+    painter->drawRoundedRect(mapped.adjusted(0, 0, -0.5, -0.5), 3, 3);
 }
 
 int Transition::type() const
@@ -218,6 +224,11 @@ QVariant Transition::itemChange(GraphicsItemChange change, const QVariant &value
         int newTrack = newPos.y() / KdenliveSettings::trackheight();
         newTrack = qMin(newTrack, projectScene()->tracksCount() - 1);
         newTrack = qMax(newTrack, 0);
+       QStringList lockedTracks = property("locked_tracks").toStringList();
+       if (lockedTracks.contains(QString::number(newTrack))) {
+           // Trying to move to a locked track
+           return pos();
+       }
         newPos.setY((int)(newTrack * KdenliveSettings::trackheight() + itemOffset() + 1));
         // Only one clip is moving
         QRectF sceneShape = rect();