[vlc-devel] commit: Qt: correct right click selection. (Jean-Baptiste Kempf )
git version control
git at videolan.org
Fri Jun 19 17:12:05 CEST 2009
vlc | branch: 1.0-bugfix | Jean-Baptiste Kempf <jb at videolan.org> | Fri Jun 19 00:16:55 2009 +0200| [d4fdf4bb743adbc3355fe0123bf7b200275892d9] | committer: Jean-Baptiste Kempf
Qt: correct right click selection.
That way, when you right-click on the not-selected item, you can delete it.
(cherry picked from commit df20afd774d8b62de3606edb6a1586011dc11804)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d4fdf4bb743adbc3355fe0123bf7b200275892d9
---
.../gui/qt4/components/playlist/standardpanel.cpp | 6 +++++-
modules/gui/qt4/util/customwidgets.hpp | 6 ++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index d2eb628..987254d 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -67,6 +67,7 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
view->setIconSize( QSize( 20, 20 ) );
view->setAlternatingRowColors( true );
view->setAnimated( true );
+ view->setSelectionBehavior( QAbstractItemView::SelectRows );
view->setSelectionMode( QAbstractItemView::ExtendedSelection );
view->setDragEnabled( true );
view->setAcceptDrops( true );
@@ -240,7 +241,10 @@ void StandardPLPanel::popupAdd()
if( currentRootId == THEPL->p_local_category->i_id ||
currentRootId == THEPL->p_local_onelevel->i_id )
{
- popup.addAction( qtr(I_PL_ADDF), THEDP, SLOT(PLAppendDialog()) );
+ popup.addAction( qtr(I_PL_ADDF), THEDP, SLOT(PLAppendDialog( OPEN_FILE_TAB )) );
+ popup.addAction( qtr(I_PL_ADDF), THEDP, SLOT(PLAppendDialog( OPEN_DISC_TAB )) );
+ popup.addAction( qtr(I_PL_ADDF), THEDP, SLOT(PLAppendDialog( OPEN_NETWORK_TAB )) );
+ popup.addAction( qtr(I_PL_ADDF), THEDP, SLOT(PLAppendDialog( OPEN_FILE_TAB )) );
popup.addAction( qtr(I_PL_ADDDIR), THEDP, SLOT( PLAppendDir()) );
}
else if( ( THEPL->p_ml_category &&
diff --git a/modules/gui/qt4/util/customwidgets.hpp b/modules/gui/qt4/util/customwidgets.hpp
index ea5b330..3037efa 100644
--- a/modules/gui/qt4/util/customwidgets.hpp
+++ b/modules/gui/qt4/util/customwidgets.hpp
@@ -101,8 +101,10 @@ public:
{
if( e->button() & Qt::RightButton )
{
- emit rightClicked( indexAt( QPoint( e->x(), e->y() ) ),
- QCursor::pos() );
+ QModelIndex index = indexAt( QPoint( e->x(), e->y() ) );
+ if( index.isValid() )
+ setSelection( visualRect( index ), QItemSelectionModel::ClearAndSelect );
+ emit rightClicked( index, QCursor::pos() );
return;
}
if( e->button() & Qt::LeftButton )
More information about the vlc-devel
mailing list