]> git.sesse.net Git - vlc/commitdiff
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 9339e40b57c38b9b593f9b3133815f378fbe05d4..641600d2d3c616c22450ccd6750b3b0b779452af 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 ea5b3309a1b84470b51e15899a33581ca98245fd..3037efa6488421389fcda04deeeb40f183670411 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 )