]> git.sesse.net Git - kdenlive/blobdiff - src/projectlistview.cpp
Fix spacer and group move sometimes moving clips to wrong place:
[kdenlive] / src / projectlistview.cpp
index a720b9da3321853867ab2723d73dbe62e153bef2..d76e85c4ff132be9fc19a703ae3b2ff161abb17c 100644 (file)
@@ -55,7 +55,6 @@ ProjectListView::ProjectListView(QWidget *parent)
     if (!KdenliveSettings::showdescriptioncolumn()) hideColumn(2);
     if (!KdenliveSettings::showratingcolumn()) hideColumn(3);
 
-    setIconSize(QSize(60, 40));
     setSortingEnabled(true);
 }
 
@@ -73,7 +72,7 @@ void ProjectListView::configureColumns(const QPoint& pos) {
         const QString text = model()->headerData(i, Qt::Horizontal).toString();
         QAction* action = popup.addAction(text);
         action->setCheckable(true);
-        action->setChecked(!headerView->isSectionHidden(logicalIndex));
+        action->setChecked(!headerView->isSectionHidden(i));
         action->setData(i);
     }
 
@@ -115,8 +114,9 @@ void ProjectListView::mouseDoubleClickEvent(QMouseEvent * event) {
     else if (item->isGroup()) {
         if ((columnAt(event->pos().x()) == 1)) QTreeWidget::mouseDoubleClickEvent(event);
     } else {
-        if ((columnAt(event->pos().x()) == 2)) QTreeWidget::mouseDoubleClickEvent(event);
-       else emit showProperties(item->referencedClip());
+        if ((columnAt(event->pos().x()) == 1) && (item->clipType() == SLIDESHOW || item->clipType() == TEXT || item->clipType() == COLOR)) QTreeWidget::mouseDoubleClickEvent(event);
+        else if ((columnAt(event->pos().x()) == 2)) QTreeWidget::mouseDoubleClickEvent(event);
+        else emit showProperties(item->referencedClip());
     }
 }
 
@@ -141,7 +141,7 @@ void ProjectListView::dropEvent(QDropEvent *event) {
         }
         const QList <QUrl> list = event->mimeData()->urls();
         foreach(const QUrl &url, list) {
-            emit addClip(url, groupName);
+            emit addClip(KUrl(url), groupName);
         }
 
     } else if (event->mimeData()->hasFormat("kdenlive/producerslist")) {
@@ -206,7 +206,7 @@ void ProjectListView::mousePressEvent(QMouseEvent *event) {
 
 // virtual
 void ProjectListView::mouseMoveEvent(QMouseEvent *event) {
-    kDebug() << "// DRAG STARTED, MOUSE MOVED: ";
+    //kDebug() << "// DRAG STARTED, MOUSE MOVED: ";
     if (!m_dragStarted) return;
 
     if ((event->pos() - m_DragStartPosition).manhattanLength()
@@ -238,15 +238,9 @@ void ProjectListView::mouseMoveEvent(QMouseEvent *event) {
             //mimeData->setText(ids.join(";")); //doc.toString());
             //mimeData->setImageData(image);
             drag->setMimeData(mimeData);
-            drag->setPixmap(clickItem->icon(0).pixmap((int)(50 *16 / 9.0), 50));
+            drag->setPixmap(clickItem->icon(0).pixmap(iconSize()));
             drag->setHotSpot(QPoint(0, 50));
-            drag->start(Qt::MoveAction);
-
-            //Qt::DropAction dropAction;
-            //dropAction = drag->start(Qt::CopyAction | Qt::MoveAction);
-
-            //Qt::DropAction dropAction = drag->exec();
-
+            Qt::DropAction dropAction = drag->exec(Qt::MoveAction);
         }
         //event->accept();
     }
@@ -254,14 +248,13 @@ void ProjectListView::mouseMoveEvent(QMouseEvent *event) {
 
 // virtual
 void ProjectListView::dragMoveEvent(QDragMoveEvent * event) {
-    QTreeWidgetItem * item = itemAt(event->pos());
     event->setDropAction(Qt::IgnoreAction);
-    //if (item) {
     event->setDropAction(Qt::MoveAction);
     if (event->mimeData()->hasText()) {
         event->acceptProposedAction();
     }
-    //}
+    // stop playing because we get a crash otherwise when fetching the thumbnails
+    emit pauseMonitor();
 }
 
 QStringList ProjectListView::mimeTypes() const {