From 694a3c5cf3c78ad38b1a2cdbe75331a44f9035df Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sat, 17 Jun 2017 13:16:59 +0000 Subject: "jump to track" dialog: always use double click (#918) git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@7239 90c681e8-e032-0410-971d-27865f9a5e38 --- src/qmmpui/forms/jumptotrackdialog.ui | 12 ++++++++++++ src/qmmpui/jumptotrackdialog.cpp | 20 ++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/qmmpui/forms/jumptotrackdialog.ui b/src/qmmpui/forms/jumptotrackdialog.ui index 8b5d9696f..2aec05b05 100644 --- a/src/qmmpui/forms/jumptotrackdialog.ui +++ b/src/qmmpui/forms/jumptotrackdialog.ui @@ -66,6 +66,9 @@ 0 + + Qt::NoFocus + Queue @@ -79,6 +82,9 @@ 0 + + Qt::NoFocus + Refresh @@ -92,6 +98,9 @@ 0 + + Qt::NoFocus + Jump To @@ -105,6 +114,9 @@ 0 + + Qt::NoFocus + QDialogButtonBox::Close diff --git a/src/qmmpui/jumptotrackdialog.cpp b/src/qmmpui/jumptotrackdialog.cpp index 8fbd6d8d9..2fa623125 100644 --- a/src/qmmpui/jumptotrackdialog.cpp +++ b/src/qmmpui/jumptotrackdialog.cpp @@ -48,8 +48,8 @@ JumpToTrackDialog::JumpToTrackDialog(PlayListModel *model, QWidget* parent) m_proxyModel->setSortLocaleAware(true); songsListView->setModel(m_proxyModel); - connect(songsListView,SIGNAL(activated(QModelIndex)),SLOT(jumpTo(QModelIndex))); - connect(songsListView,SIGNAL(activated(QModelIndex)),SLOT(accept())); + connect(songsListView,SIGNAL(doubleClicked(QModelIndex)),SLOT(jumpTo(QModelIndex))); + connect(songsListView,SIGNAL(doubleClicked(QModelIndex)),SLOT(accept())); connect(songsListView->selectionModel(),SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), SLOT(queueUnqueue(QModelIndex, QModelIndex))); @@ -60,6 +60,7 @@ JumpToTrackDialog::JumpToTrackDialog(PlayListModel *model, QWidget* parent) new QShortcut(tr("F5"),this,SLOT(on_refreshPushButton_clicked())); filterLineEdit->installEventFilter(this); + songsListView->installEventFilter(this); connect(filterLineEdit, SIGNAL(textChanged(QString)), m_proxyModel, SLOT(setFilterFixedString(QString))); @@ -176,5 +177,20 @@ bool JumpToTrackDialog::eventFilter(QObject *o, QEvent *e) return true; } } + else if(o == songsListView && e->type() == QEvent::KeyPress) + { + QKeyEvent *key_event = static_cast(e); + QModelIndex index = songsListView->currentIndex(); + + if(key_event->key() == Qt::Key_Return) + { + if(index.isValid()) + { + jumpTo(index); + accept(); + } + return true; + } + } return QDialog::eventFilter(o, e); } -- cgit v1.2.3-13-gbd6f