Commit 29bfe1c8 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Merge branch '2004'

parents c7bc184b 8796b4f9
Pipeline #19465 passed with stage
in 10 minutes and 4 seconds
......@@ -2878,14 +2878,6 @@ void Bin::slotEffectDropped(const QStringList &effectData, const QModelIndex &pa
row = parent.row();
parentIndex = parent.parent();
}
m_proxyModel->selectionModel()->clearSelection();
const QModelIndex id = m_itemModel->index(row, 0, parentIndex);
const QModelIndex id2 = m_itemModel->index(row, m_itemModel->columnCount() - 1, parentIndex);
if (id.isValid() && id2.isValid()) {
m_proxyModel->selectionModel()->select(QItemSelection(m_proxyModel->mapFromSource(id), m_proxyModel->mapFromSource(id2)),
QItemSelectionModel::Select);
}
setCurrent(parentItem);
bool res = false;
if (effectData.count() == 4) {
// Paste effect from another stack
......@@ -2896,6 +2888,15 @@ void Bin::slotEffectDropped(const QStringList &effectData, const QModelIndex &pa
}
if (!res) {
pCore->displayMessage(i18n("Cannot add effect to clip"), InformationMessage);
} else {
m_proxyModel->selectionModel()->clearSelection();
const QModelIndex id = m_itemModel->index(row, 0, parentIndex);
const QModelIndex id2 = m_itemModel->index(row, m_itemModel->columnCount() - 1, parentIndex);
if (id.isValid() && id2.isValid()) {
m_proxyModel->selectionModel()->select(QItemSelection(m_proxyModel->mapFromSource(id), m_proxyModel->mapFromSource(id2)),
QItemSelectionModel::Select);
}
setCurrent(parentItem);
}
}
}
......
......@@ -77,7 +77,6 @@ public:
/* @brief Delete all the markers of the model */
bool removeAllMarkers();
protected:
/* @brief Same function but accumulates undo/redo */
bool removeMarker(GenTime pos, Fun &undo, Fun &redo);
......
......@@ -1112,10 +1112,22 @@ void ClipPropertiesController::slotEditMarker()
void ClipPropertiesController::slotDeleteMarker()
{
auto markerModel = m_controller->getMarkerModel();
auto current = m_markerTree->currentIndex();
if (!current.isValid()) return;
GenTime pos(markerModel->data(current, MarkerListModel::PosRole).toDouble());
markerModel->removeMarker(pos);
QModelIndexList indexes = m_markerTree->selectionModel()->selectedIndexes();
QList <GenTime> positions;
for (auto &ix : indexes) {
if (ix.isValid()) {
positions << GenTime(markerModel->data(ix, MarkerListModel::PosRole).toDouble());
}
}
if (!positions.isEmpty()) {
Fun undo = []() { return true; };
Fun redo = []() { return true; };
for (GenTime pos : positions) {
markerModel->removeMarker(pos, undo, redo);
}
pCore->pushUndo(undo, redo, i18n("Delete marker"));
}
}
void ClipPropertiesController::slotAddMarker()
......
Markdown is supported
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