Commit 6b47852a authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix timeline scrolling below zero and timeline drag/drop bug

parent da75c7b0
......@@ -700,6 +700,14 @@ void MyListView::mousePressEvent(QMouseEvent *event)
void MyListView::mouseMoveEvent(QMouseEvent *event)
{
if ((event->buttons() & Qt::LeftButton) != 0u && (event->pos() - m_startPos).manhattanLength() > QApplication::startDragDistance()) {
QModelIndexList indexes = selectedIndexes();
auto *drag = new QDrag(this);
drag->setMimeData(model()->mimeData(indexes));
drag->exec();
emit processDragEnd();
return;
}
QModelIndex index = indexAt(event->pos());
if (index.isValid()) {
if (KdenliveSettings::hoverPreview()) {
......
......@@ -2365,6 +2365,7 @@ void Monitor::loadQmlScene(MonitorSceneType type, const QVariant &sceneData)
break;
case MonitorSceneDefault:
QObject::connect(root, SIGNAL(editCurrentMarker()), this, SLOT(slotEditInlineMarker()), Qt::UniqueConnection);
QObject::connect(root, SIGNAL(endDrag()), pCore->bin(), SIGNAL(processDragEnd()), Qt::UniqueConnection);
m_qmlManager->setProperty(QStringLiteral("timecode"), m_timePos->displayText());
if (m_id == Kdenlive::ClipMonitor) {
updateQmlDisplay(KdenliveSettings::displayClipMonitorInfo());
......
......@@ -69,6 +69,7 @@ Item {
}
signal editCurrentMarker()
signal endDrag()
function updateScrolling()
{
......@@ -570,6 +571,12 @@ Item {
propagateComposedEvents: true
cursorShape: Qt.PointingHand
drag.target: parent
property bool dragActive: drag.active
onDragActiveChanged: {
if (!drag.active) {
root.endDrag()
}
}
onPressed: {
dragZone.uuid = controller.getUuid()
}
......@@ -595,6 +602,12 @@ Item {
propagateComposedEvents: true
cursorShape: Qt.PointingHand
drag.target: parent
property bool dragActive: drag.active
onDragActiveChanged: {
if (!drag.active) {
root.endDrag()
}
}
onPressed: {
dragZone.uuid = controller.getUuid()
}
......
......@@ -170,7 +170,7 @@ Rectangle {
function horizontalScroll(wheel) {
var initialX = scrollView.contentX
if (wheel.angleDelta.y < 0) {
scrollView.contentX = Math.min(scrollView.contentX - wheel.angleDelta.y, timeline.fullDuration * root.timeScale - scrollView.width)
scrollView.contentX = Math.max(0, Math.min(scrollView.contentX - wheel.angleDelta.y, timeline.fullDuration * root.timeScale - scrollView.width))
} else {
scrollView.contentX = Math.max(scrollView.contentX - wheel.angleDelta.y, 0)
}
......@@ -191,7 +191,7 @@ Rectangle {
function verticalScroll(wheel) {
if (wheel.angleDelta.y < 0) {
scrollView.contentY = Math.min(scrollView.contentY - wheel.angleDelta.y, trackHeaders.height + subtitleTrackHeader.height - tracksArea.height + horZoomBar.height + ruler.height)
scrollView.contentY = Math.max(0, Math.min(scrollView.contentY - wheel.angleDelta.y, trackHeaders.height + subtitleTrackHeader.height - tracksArea.height + horZoomBar.height + ruler.height))
} else {
scrollView.contentY = Math.max(scrollView.contentY - wheel.angleDelta.y, 0)
}
......@@ -680,7 +680,7 @@ Rectangle {
clearDropData()
}
onEntered: {
if (clipBeingDroppedId > -1 && lastDragUuid != drag.getDataAsString('kdenlive/dragid')) {
if (clipBeingDroppedId > -1 && lastDragUuid != drag.getDataAsString('kdenlive/dragid') && timeline.exists(clipBeingDroppedId)) {
// We are re-entering drop zone with another drag operation, ensure the previous drop operation is complete
processDrop()
}
......@@ -723,9 +723,13 @@ Rectangle {
// If we exit on top, remove clip
controller.requestItemDeletion(clipBeingDroppedId, false)
clearDropData()
} else {
} else if (clipBeingDroppedId > -1) {
// Clip is dropped
processDrop()
//console.log('Dragging on left side!!!!!!!!!!!!!!!!!!!!!!!!!!!')
var moveData = controller.suggestClipMove(clipBeingDroppedId, fakeTrack, 0, root.consumerPosition, root.snapping)
fakeFrame = moveData[0]
fakeTrack = moveData[1]
timeline.activeTrack = fakeTrack
}
}
onPositionChanged: {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment