]> git.sesse.net Git - kdenlive/blobdiff - src/abstractgroupitem.cpp
Use const'ref.
[kdenlive] / src / abstractgroupitem.cpp
index abf061c7a4382a80655c755721dc7dc088af2352..83f5e59fea65067eeadbe5f11e1fa228f9e8e401 100644 (file)
@@ -92,6 +92,11 @@ CustomTrackScene* AbstractGroupItem::projectScene()
     return NULL;
 }
 
+QPainterPath AbstractGroupItem::clipGroupSpacerShape(QPointF offset) const
+{
+    return spacerGroupShape(AVWIDGET, offset);
+}
+
 QPainterPath AbstractGroupItem::clipGroupShape(QPointF offset) const
 {
     return groupShape(AVWIDGET, offset);
@@ -125,6 +130,31 @@ QPainterPath AbstractGroupItem::groupShape(GRAPHICSRECTITEM type, QPointF offset
     return path;
 }
 
+QPainterPath AbstractGroupItem::spacerGroupShape(GRAPHICSRECTITEM type, QPointF offset) const
+{
+    QPainterPath path;
+    QList<QGraphicsItem *> children = childItems();
+    for (int i = 0; i < children.count(); i++) {
+        if (children.at(i)->type() == (int)type) {
+            QRectF r(children.at(i)->sceneBoundingRect());
+            r.translate(offset);
+           r.setRight(scene()->width());
+            path.addRect(r);
+        } else if (children.at(i)->type() == GROUPWIDGET) {
+            QList<QGraphicsItem *> subchildren = children.at(i)->childItems();
+            for (int j = 0; j < subchildren.count(); j++) {
+                if (subchildren.at(j)->type() == (int)type) {
+                    QRectF r(subchildren.at(j)->sceneBoundingRect());
+                    r.translate(offset);
+                   r.setRight(scene()->width());
+                    path.addRect(r);
+                }
+            }
+        }
+    }
+    return path;
+}
+
 void AbstractGroupItem::addItem(QGraphicsItem * item)
 {
     addToGroup(item);
@@ -158,15 +188,13 @@ void AbstractGroupItem::paint(QPainter *p, const QStyleOptionGraphicsItem *optio
     QColor bgcolor(100, 100, 200, 100);
     QRectF bound = option->exposedRect.adjusted(0, 0, 1, 1);
     p->setClipRect(bound);
-    const QRectF mapped = p->worldTransform().mapRect(option->exposedRect);
-    p->setWorldMatrixEnabled(false);
     p->setBrush(bgcolor);
     QPen pen = p->pen();
     pen.setColor(QColor(200, 90, 90));
     pen.setStyle(Qt::DashLine);
     pen.setWidthF(0.0);
     p->setPen(pen);
-    p->drawRoundedRect(mapped, 3, 3);
+    p->drawRoundedRect(boundingRect().adjusted(0, 0, -1, 0), 3, 3);
 }
 
 //virtual