Skip to content

Commit

Permalink
Tracks table: Return key invokes configured double-click action
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Jan 24, 2024
1 parent fde79f3 commit c9fbb0f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/widget/wtracktableview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ void WTrackTableView::initTrackMenu() {
// slot
void WTrackTableView::slotMouseDoubleClicked(const QModelIndex& index) {
// Read the current TrackDoubleClickAction setting
// TODO simplify this casting madness
int doubleClickActionConfigValue =
m_pConfig->getValue(mixxx::library::prefs::kTrackDoubleClickActionConfigKey,
static_cast<int>(DlgPrefLibrary::TrackDoubleClickAction::LoadToDeck));
Expand Down Expand Up @@ -822,11 +823,17 @@ TrackModel* WTrackTableView::getTrackModel() const {
void WTrackTableView::keyPressEvent(QKeyEvent* event) {
switch (event->key()) {
case kPropertiesShortcutKey: {
// Return invokes the double-click action.
// Ctrl+Return opens track properties dialog.
// Ignore it if any cell editor is open.
// Note: the shortcut is displayed in the track context menu
if ((event->modifiers() & kPropertiesShortcutModifier) &&
state() != QTableView::EditingState) {
// Note: we use kPropertiesShortcutKey/~Mofifier here and in
// in WTrackMenu to display the shortcut.
if (state() == QTableView::EditingState) {
break;
}
if (event->modifiers().testFlag(Qt::NoModifier)) {
slotMouseDoubleClicked(currentIndex());
} else if ((event->modifiers() & kPropertiesShortcutModifier)) {
QModelIndexList indices = selectionModel()->selectedRows();
if (indices.length() == 1) {
m_pTrackMenu->loadTrackModelIndices(indices);
Expand Down

0 comments on commit c9fbb0f

Please sign in to comment.