CollectionView: Implement add to playlist with enter

Fixes #1360
This commit is contained in:
Jonas Kvinge 2024-01-19 23:04:03 +01:00
parent a98c209101
commit f901f802bb
2 changed files with 17 additions and 0 deletions

View File

@ -343,6 +343,22 @@ void CollectionView::mouseReleaseEvent(QMouseEvent *e) {
}
void CollectionView::keyPressEvent(QKeyEvent *e) {
switch (e->key()) {
case Qt::Key_Enter:
case Qt::Key_Return:
if (currentIndex().isValid()) {
AddToPlaylist();
}
e->accept();
break;
}
AutoExpandingTreeView::keyPressEvent(e);
}
void CollectionView::contextMenuEvent(QContextMenuEvent *e) {
if (!context_menu_) {

View File

@ -93,6 +93,7 @@ class CollectionView : public AutoExpandingTreeView {
protected:
// QWidget
void paintEvent(QPaintEvent *event) override;
void keyPressEvent(QKeyEvent *e) override;
void mouseReleaseEvent(QMouseEvent *e) override;
void contextMenuEvent(QContextMenuEvent *e) override;