Qt: correct right click selection.
authorJean-Baptiste Kempf <jb@videolan.org>
Thu, 18 Jun 2009 22:16:55 +0000 (00:16 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Fri, 19 Jun 2009 14:53:26 +0000 (16:53 +0200)
That way, when you right-click on the not-selected item, you can delete it.

modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/util/customwidgets.hpp

index 9339e40..641600d 100644 (file)
@@ -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 &&
index ea5b330..3037efa 100644 (file)
@@ -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 )