1. Victor Kotseruba
  2. kdenlive

Commits

Jean-Baptiste Mardelle  committed 5eaf1c6

Fix wrong group moving when groups overlap

  • Participants
  • Parent commits f757328
  • Branches master

Comments (0)

Files changed (3)

File src/clipitem.cpp

View file
  • Ignore whitespace
         m_baseColor = QColor(141, 215, 166);
         connect(m_clip, SIGNAL(gotAudioData()), this, SLOT(slotGotAudioData()));
     }
+    m_paintColor = m_baseColor;
 }
 
 
                      QWidget *)
 {
     QPalette palette = scene()->palette();
-    QColor paintColor;
+    QColor paintColor = m_paintColor;
     QColor textColor;
     QColor textBgColor;
     QPen framePen;
-    if (parentItem()) paintColor = QColor(255, 248, 149);
-    else paintColor = m_baseColor;
     if (isSelected() || (parentItem() && parentItem()->isSelected())) {
 	textColor = palette.highlightedText().color();
 	textBgColor = palette.highlight().color();
-        paintColor = paintColor.darker();
         framePen.setColor(textBgColor);
+	paintColor.setRed(qMin(paintColor.red() * 2, 255));
     }
     else {
 	textColor = palette.text().color();
 	textBgColor = palette.window().color();
 	textBgColor.setAlpha(200);
-        framePen.setColor(paintColor.darker());
+        framePen.setColor(m_paintColor.darker());
     }
     const QRectF exposed = option->exposedRect;
     const QTransform transformation = painter->worldTransform();
     painter->setClipPath(p.intersected(q));
     painter->setPen(Qt::NoPen);
     painter->fillRect(mappedExposed, paintColor);
-    painter->setPen(paintColor.darker());
+    painter->setPen(m_paintColor.darker());
     // draw thumbnails
     if (KdenliveSettings::videothumbnails() && !isAudioOnly()) {
 	QRectF thumbRect;
 QVariant ClipItem::itemChange(GraphicsItemChange change, const QVariant &value)
 {
     if (change == QGraphicsItem::ItemSelectedChange) {
-        if (value.toBool()) setZValue(10);
-        else setZValue(2);
+        if (value.toBool())
+	    setZValue(10);
+        else
+	    setZValue(2);
     }
     if (change == ItemPositionChange && scene()) {
         // calculate new position.
         //kDebug()<<"// ITEM NEW POS: "<<newPos.x()<<", mapped: "<<mapToScene(newPos.x(), 0).x();
         return newPos;
     }
+    if (change == ItemParentChange) {
+	QGraphicsItem* parent = value.value<QGraphicsItem*>();
+	if (parent) m_paintColor = m_baseColor.lighter(135);
+	else m_paintColor = m_baseColor;
+    }
     return QGraphicsItem::itemChange(change, value);
 }
 
         } else if (m_clipType == AUDIO) m_baseColor = QColor(141, 215, 166);
         else m_baseColor = QColor(141, 166, 215);
     }
+    if (parentItem())
+	m_paintColor = m_baseColor.lighter(135);
+    else
+	m_paintColor = m_baseColor;
     m_audioThumbCachePic.clear();
 }
 

File src/clipitem.h

View file
  • Ignore whitespace
     bool m_audioOnly;
     bool m_videoOnly;
     QColor m_baseColor;
+    QColor m_paintColor;
 
     QPixmap m_startPix;
     QPixmap m_endPix;

File src/customtrackview.cpp

View file
  • Ignore whitespace
 	QGraphicsView::mousePressEvent(event);
         return;
     }
-
     // if a guide and a clip were pressed, just select the guide
     for (int i = 0; i < collisionList.count(); ++i) {
         if (collisionList.at(i)->type() == GUIDEITEM) {
 	}*/
 
         bool selected = !m_dragItem->isSelected();
+	m_dragItem->setZValue(99);
+	if (m_dragItem->parentItem()) m_dragItem->parentItem()->setZValue(99);
 	QGraphicsView::mousePressEvent(event);
+	
         if (dragGroup) {
             dragGroup->setSelected(selected);
 	    QList<QGraphicsItem *> children = dragGroup->childItems();