diff options
author | ronso0 <ronso0@mixxx.org> | 2021-10-02 16:14:56 +0200 |
---|---|---|
committer | ronso0 <ronso0@mixxx.org> | 2021-10-04 02:36:40 +0200 |
commit | 58d34d5953096b2bf1962bcd536c7e3f426a9624 (patch) | |
tree | 17047de78cf1e754129803c6a0905aa70cdab08b /src | |
parent | 8dfe58bb251d49bbb47a5175249bb18e1a277746 (diff) |
library: add keyboard shortcut to open track properties
Diffstat (limited to 'src')
-rw-r--r-- | src/widget/wtracktableview.cpp | 19 |
1 files 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() { |