From 58d34d5953096b2bf1962bcd536c7e3f426a9624 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Sat, 2 Oct 2021 16:14:56 +0200 Subject: library: add keyboard shortcut to open track properties --- src/widget/wtracktableview.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/widget/wtracktableview.cpp b/src/widget/wtracktableview.cpp index 0b1dced945..b6eac0080a 100644 --- a/src/widget/wtracktableview.cpp +++ b/src/widget/wtracktableview.cpp @@ -755,14 +755,19 @@ TrackModel* WTrackTableView::getTrackModel() const { } void WTrackTableView::keyPressEvent(QKeyEvent* event) { - if (event->key() == Qt::Key_Return) { - // It is not a good idea if 'key_return' - // causes a track to load since we allow in-line editing - // of table items in general - return; - } else { - QTableView::keyPressEvent(event); + // Ctrl+Return opens track properties dialog. + // Ignore it if any cell editor is open. + // Note: the shortcut display string needs to be set in WTrackMenu accordingly. + if (event->key() == Qt::Key_Return && + event->modifiers() & Qt::ControlModifier && + state() != QTableView::EditingState) { + QModelIndexList indices = selectionModel()->selectedRows(); + if (indices.length() == 1) { + m_pTrackMenu->loadTrackModelIndices(indices); + m_pTrackMenu->slotShowDlgTrackInfo(); + } } + QTableView::keyPressEvent(event); } void WTrackTableView::loadSelectedTrack() { -- cgit v1.2.3