Hotkey to delete marker connected to non-existing method

The hotkey to delete a marker does not work on the timeline.
This seems to be because the trigger method calls the 1-ary method deleteMarker without argument.

src/docks/timelinedock.cpp line 834 defines:

action = new QAction(tr("Delete Marker"), this);
action->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_M));
connect(action, &QAction::triggered, this, [&]() {
    if (!isMultitrackValid()) return;
    show();
    raise();
    deleteMarker(); // method not defined
});
Actions.add("timelineDeleteMarkerAction", action);

There is no 0-ary method deleteMarker, instead there is a 1-ary method in line 2518:

void TimelineDock::deleteMarker(int markerIndex)
{
    if (markerIndex < 0) {
        markerIndex = m_markersModel.markerIndexForPosition(m_position);
    }
    if (markerIndex >= 0) {
        m_markersModel.remove(markerIndex);
    }
}

I do not know why the above code compiles. Unfortunatley, lib qt6-base-dev is still on Qt version 6.2 for my distro, preventing me from trying to compile myself.

Although hotkey Ctrl+Shift+M does not work on the timeline directly,
it works on the marker dock, because the marker dock calls the timeline with argument in src/qmltypes/qmlmarkermenu.cpp line 70:

QAction deleteAction(tr("Delete"));
deleteAction.setShortcut(Actions["timelineDeleteMarkerAction"]->shortcut());
connect(&deleteAction, &QAction::triggered, this, [&]() {
    m_timeline->deleteMarker(m_index);
});
menu.addAction(&deleteAction);

Timeline dock action could be changed to call deleteMarker(-1);, so that one of the markers under the current playhead is removed.

It works for me.

It is defined with a default parameter of -1

To use it on the timeline, the cursor has to be on the marker.

You’re right. I didn’t realize that the marker must be clicked, because it has no highlight. Clicking the marker will also move the playhead, so I never do that.

You are right. I have found the definition in the header declaration in timelinedock.h:

void deleteMarker(int markerIndex = -1);

I had expected the definition to be mentioned in the implementation.

But you do not need to click the marker. There are multiple ways to get there.