Ignore invalid drop in timeline

Fixes #972

In the timeline widget, if a piece is dropped beyond the last step, it
will disappear from the model. Ignore these invalid drag and drops.
This commit is contained in:
Thiébaud Weksteen
2025-04-18 20:41:06 +10:00
parent 3187ae15d6
commit 10c4349e47
+7 -7
View File
@@ -567,14 +567,14 @@ void lcTimelineWidget::dropEvent(QDropEvent* Event)
QList<QTreeWidgetItem*> SelectedItems = selectedItems();
clearSelection();
if (DropItem)
{
QTreeWidgetItem* ParentItem = DropItem->parent();
lcStep Step = indexOfTopLevelItem(ParentItem ? ParentItem : DropItem) + 1;
if (!DropItem)
return;
if (Step > Model->GetCurrentStep())
Model->SetCurrentStep(Step);
}
QTreeWidgetItem* ParentItem = DropItem->parent();
lcStep Step = indexOfTopLevelItem(ParentItem ? ParentItem : DropItem) + 1;
if (Step > Model->GetCurrentStep())
Model->SetCurrentStep(Step);
auto SortItems = [this](QTreeWidgetItem* Item1, QTreeWidgetItem* Item2)
{