]> git.sesse.net Git - kdenlive/blobdiff - src/clipitem.cpp
Fix several title clips problems, including:
[kdenlive] / src / clipitem.cpp
index e270b4ee2df595f22b0836d2970d7f81535a9070..94a5f046b8056f4aee3be61dc6d065c386980391 100644 (file)
 #include <QGraphicsScene>
 #include <QMimeData>
 
-ClipItem::ClipItem(DocClipBase *clip, ItemInfo info, double fps, double speed, bool generateThumbs)
-        : AbstractClipItem(info, QRectF(), fps), m_clip(clip), m_resizeMode(NONE), m_grabPoint(0), m_maxTrack(0), m_hasThumbs(false), startThumbTimer(NULL), endThumbTimer(NULL), audioThumbWasDrawn(false), m_opacity(1.0), m_timeLine(0), m_startThumbRequested(false), m_endThumbRequested(false), m_startFade(0), m_endFade(0), m_hover(false), m_selectedEffect(-1), m_speed(speed), framePixelWidth(0), m_startPix(QPixmap()), m_endPix(QPixmap()), m_videoOnly(false), m_audioOnly(false)
+ClipItem::ClipItem(DocClipBase *clip, ItemInfo info, double fps, double speed, bool generateThumbs) :
+        AbstractClipItem(info, QRectF(), fps),
+        m_clip(clip),
+        m_resizeMode(NONE),
+        m_grabPoint(0),
+        m_startFade(0),
+        m_endFade(0),
+        m_maxTrack(0),
+        m_audioOnly(false),
+        m_videoOnly(false),
+        m_startPix(QPixmap()),
+        m_endPix(QPixmap()),
+        m_hasThumbs(false),
+        startThumbTimer(NULL),
+        endThumbTimer(NULL),
+        m_selectedEffect(-1),
+        m_opacity(1.0),
+        m_timeLine(0),
+        m_startThumbRequested(false),
+        m_endThumbRequested(false),
+        m_hover(false),
+        m_speed(speed),
+        audioThumbWasDrawn(false),
+        framePixelWidth(0)
 {
     setZValue(1);
     setRect(0, 0, (info.endPos - info.startPos).frames(fps) - 0.02, (double)(KdenliveSettings::trackheight() - 2));
@@ -689,10 +711,10 @@ void ClipItem::paint(QPainter *painter,
                 const QRectF r1(framepos + 0.04, 10, itemWidth - framepos - 2, itemHeight - 10);
                 const QRectF r2 = painter->matrix().mapRect(r1);
                 const QRectF txtBounding = painter->boundingRect(r2, Qt::AlignLeft | Qt::AlignTop, ' ' + (*it).comment() + ' ');
-
-                QPainterPath path;
-                path.addRoundedRect(txtBounding, 3, 3);
-                painter->fillPath(path, markerBrush);
+                painter->setBrush(markerBrush);
+                painter->setPen(Qt::NoPen);
+                painter->drawRoundedRect(txtBounding, 3, 3);
+                painter->setPen(Qt::white);
                 painter->drawText(txtBounding, Qt::AlignCenter, (*it).comment());
             }
             //painter->fillRect(QRect(br.x() + framepos, br.y(), 10, br.height()), QBrush(QColor(0, 0, 0, 150)));
@@ -746,9 +768,10 @@ void ClipItem::paint(QPainter *painter,
             txtBounding.setWidth(txtBounding.width() * value);
             markerBrush.setColor(QColor(50 + 200 * (1.0 - value), 50, 50, 100 + 50 * value));
         } else markerBrush.setColor(QColor(50, 50, 50, 150));
-        QPainterPath path;
-        path.addRoundedRect(txtBounding, 4, 4);
-        painter->fillPath(path/*.intersected(resultClipPath)*/, markerBrush);
+        painter->setBrush(markerBrush);
+        painter->setPen(Qt::NoPen);
+        painter->drawRoundedRect(txtBounding, 3, 3);
+        painter->setPen(Qt::white);
         painter->drawText(txtBounding, Qt::AlignCenter, m_effectNames);
         painter->setPen(Qt::black);
     }
@@ -757,7 +780,7 @@ void ClipItem::paint(QPainter *painter,
     // draw frame around clip
     QColor frameColor(Qt::black);
     int alphaBase = 60;
-    if (isSelected() || parentItem() && parentItem()->isSelected()) {
+    if (isSelected() || (parentItem() && parentItem()->isSelected())) {
         frameColor = QColor(Qt::red);
         alphaBase = 90;
     }