From 71219c5d86572d2d598ca844bc9a7353d19d3f8c Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Kempf Date: Mon, 21 Jan 2008 22:47:06 +0000 Subject: [PATCH] Qt4 - add a button to scroll to currentItem. Close #1443 --- modules/gui/qt4/components/playlist/panels.hpp | 3 ++- modules/gui/qt4/components/playlist/standardpanel.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/gui/qt4/components/playlist/panels.hpp b/modules/gui/qt4/components/playlist/panels.hpp index 1ac3c18474..e6b41c409c 100644 --- a/modules/gui/qt4/components/playlist/panels.hpp +++ b/modules/gui/qt4/components/playlist/panels.hpp @@ -72,7 +72,7 @@ protected: friend class PlaylistWidget; private: QTreeView *view; - QPushButton *repeatButton , *randomButton,*addButton; + QPushButton *repeatButton, *randomButton, *addButton, *gotoPlayingButton; ClickLineEdit *searchLine; int currentRootId; QSignalMapper *ContextUpdateMapper; @@ -84,6 +84,7 @@ private slots: void handleExpansion( const QModelIndex& ); void toggleRandom(); void toggleRepeat(); + void gotoPlayingItem(); void doPopup( QModelIndex index, QPoint point ); void search( QString search ); void clearFilter(); diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp index b3d29f00f4..4709378c2e 100644 --- a/modules/gui/qt4/components/playlist/standardpanel.cpp +++ b/modules/gui/qt4/components/playlist/standardpanel.cpp @@ -133,6 +133,11 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent, BUTTONACT( repeatButton, toggleRepeat() ); buttons->addWidget( repeatButton ); + /* Goto */ + gotoPlayingButton = new QPushButton( qtr( "X" ), this ); + BUTTONACT( gotoPlayingButton, gotoPlayingItem() ); + buttons->addWidget( gotoPlayingButton ); + /* A Spacer and the search possibilities */ QSpacerItem *spacer = new QSpacerItem( 10, 20 ); buttons->addItem( spacer ); @@ -193,6 +198,11 @@ void StandardPLPanel::toggleRandom() randomButton->setToolTip( prev ? qtr( I_PL_NORANDOM ) : qtr(I_PL_RANDOM ) ); } +void StandardPLPanel::gotoPlayingItem() +{ + view->scrollTo( view->currentIndex() ); +} + void StandardPLPanel::handleExpansion( const QModelIndex &index ) { if( model->isCurrent( index ) ) -- 2.20.1