[vlc-devel] [PATCH] Add shortcut to set focus on playlist search field
Guillaume Gomez
guillaume1.gomez at gmail.com
Fri Mar 4 02:36:13 CET 2016
Signed-off-by: Guillaume Gomez <guillaume1.gomez at gmail.com>
---
modules/gui/qt4/components/playlist/playlist.cpp | 5 +++++
modules/gui/qt4/components/playlist/playlist.hpp | 1 +
modules/gui/qt4/main_interface.cpp | 6 ++++++
3 files changed, 12 insertions(+)
diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp
index 7091805..cc89300 100644
--- a/modules/gui/qt4/components/playlist/playlist.cpp
+++ b/modules/gui/qt4/components/playlist/playlist.cpp
@@ -226,6 +226,11 @@ void PlaylistWidget::changeView( const QModelIndex& index )
locationBar->setIndex( index );
}
+void PlaylistWidget::setSearchFieldFocus()
+{
+ searchEdit->setFocus();
+}
+
#include <QSignalMapper>
#include <QMenu>
#include <QPainter>
diff --git a/modules/gui/qt4/components/playlist/playlist.hpp b/modules/gui/qt4/components/playlist/playlist.hpp
index 642e538..48d682f 100644
--- a/modules/gui/qt4/components/playlist/playlist.hpp
+++ b/modules/gui/qt4/components/playlist/playlist.hpp
@@ -56,6 +56,7 @@ public:
void forceHide();
void forceShow();
+ void setSearchFieldFocus();
QStackedWidget *artContainer;
StandardPLPanel *mainView;
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index 6028b10..4ebbdd6 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -1448,6 +1448,12 @@ void MainInterface::handleKeyPress( QKeyEvent *e )
toggleMinimalView( !b_minimalView );
e->accept();
}
+ else if( ( e->modifiers() & Qt::ControlModifier ) && ( e->key() == Qt::Key_K ) &&
+ playlistWidget )
+ {
+ playlistWidget->setSearchFieldFocus();
+ e->accept();
+ }
int i_vlck = qtEventToVLCKey( e );
if( i_vlck > 0 )
--
1.9.1
More information about the vlc-devel
mailing list