#include "abstractclipitem.h"
#include "kdenlivesettings.h"
#include "customtrackscene.h"
+#include "customtrackview.h"
#include <KDebug>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
+#include <QDomDocument>
+#include <QMimeData>
AbstractGroupItem::AbstractGroupItem(double fps): QGraphicsItemGroup(), m_fps(fps) {
setZValue(2);
setFlags(QGraphicsItem::ItemClipsToShape | QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
+ setAcceptDrops(true);
}
int AbstractGroupItem::type() const {
return GROUPWIDGET;
}
-const int AbstractGroupItem::track() const {
+int AbstractGroupItem::track() const {
return (int)(scenePos().y() / KdenliveSettings::trackheight());
}
newPos.setX(xpos);
QPointF start = pos();
- int startTrack = (start.y() + trackHeight / 2) / trackHeight;
+ //int startTrack = (start.y() + trackHeight / 2) / trackHeight;
int newTrack = (newPos.y()) / trackHeight;
//kDebug()<<"// GROUP NEW T:"<<newTrack<<",START T:"<<startTrack<<",MAX:"<<projectScene()->tracksCount() - 1;
newTrack = qMin(newTrack, projectScene()->tracksCount() - (int)(boundingRect().height() + 5) / trackHeight);
else {
bool forwardMove = newPos.x() > start.x();
int offset = 0;
- const double width = sceneBoundingRect().width() + 1;
for (int i = 0; i < collindingItems.count(); i++) {
QGraphicsItem *collision = collindingItems.at(i);
if (collision->type() == AVWIDGET) {
return QGraphicsItemGroup::itemChange(change, value);
}
+//virtual
+void AbstractGroupItem::dropEvent(QGraphicsSceneDragDropEvent * event) {
+ QString effects = QString(event->mimeData()->data("kdenlive/effectslist"));
+ QDomDocument doc;
+ doc.setContent(effects, true);
+ QDomElement e = doc.documentElement();
+ CustomTrackView *view = (CustomTrackView *) scene()->views()[0];
+ if (view) view->slotAddGroupEffect(e, this);
+}
+
+//virtual
+void AbstractGroupItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event) {
+ event->setAccepted(event->mimeData()->hasFormat("kdenlive/effectslist"));
+}
+
+void AbstractGroupItem::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) {
+ Q_UNUSED(event);
+}