1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-16 19:14:06 +02:00

* Activate item when pressing return / enter.

This commit is contained in:
Christian Muehlhaeuser
2010-12-01 06:31:47 +01:00
parent fa1252716e
commit 89da3f6f85
4 changed files with 19 additions and 2 deletions

View File

@@ -81,7 +81,7 @@ void
PlaylistView::keyPressEvent( QKeyEvent* event )
{
qDebug() << Q_FUNC_INFO;
QTreeView::keyPressEvent( event );
TrackView::keyPressEvent( event );
if ( !model() )
return;

View File

@@ -17,7 +17,7 @@ public:
void setModel( TrackModel* model );
protected:
virtual void keyPressEvent( QKeyEvent* event );
void keyPressEvent( QKeyEvent* event );
private slots:
void onCustomContextMenu( const QPoint& pos );

View File

@@ -144,6 +144,22 @@ TrackView::onItemActivated( const QModelIndex& index )
}
void
TrackView::keyPressEvent( QKeyEvent* event )
{
qDebug() << Q_FUNC_INFO;
QTreeView::keyPressEvent( event );
if ( !model() )
return;
if ( event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return )
{
onItemActivated( currentIndex() );
}
}
void
TrackView::onItemResized( const QModelIndex& index )
{

View File

@@ -45,6 +45,7 @@ protected:
virtual void dropEvent( QDropEvent* event );
void paintEvent( QPaintEvent* event );
void keyPressEvent( QKeyEvent* event );
private slots:
void onItemResized( const QModelIndex& index );