Commit 465f5a01 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: fix the view checked() state in the ViewMenu

parent 6950dc05
......@@ -111,7 +111,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
CONNECT( viewSelectionMapper, mapped( int ), mainView, showView( int ) );
QActionGroup *actionGroup = new QActionGroup( this );
QAction *viewActions[StandardPLPanel::VIEW_COUNT];
for( int i = 0; i < StandardPLPanel::VIEW_COUNT; i++ )
{
viewActions[i] = actionGroup->addAction( viewNames[i] );
......@@ -119,6 +119,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
viewSelectionMapper->setMapping( viewActions[i], i );
CONNECT( viewActions[i], triggered(), viewSelectionMapper, map() );
}
viewActions[0]->setChecked( true );
QMenu *viewMenu = new QMenu( viewButton );
viewMenu->addActions( actionGroup->actions() );
......@@ -223,9 +224,10 @@ void PlaylistWidget::changeView( const QModelIndex& index )
{
searchEdit->clear();
locationBar->setIndex( index );
int i = mainView->getViewNumber();
viewActions[i]->setChecked(true);
}
#include <QSignalMapper>
#include <QMenu>
#include <QPainter>
......
......@@ -57,6 +57,8 @@ private:
QSplitter *leftSplitter;
StandardPLPanel *mainView;
QAction *viewActions[ 4 /* StandardPLPanel::VIEW_COUNT*/ ];
LocationBar *locationBar;
SearchLineEdit *searchEdit;
......
......@@ -348,11 +348,20 @@ void StandardPLPanel::showView( int i_view )
}
viewStack->setCurrentWidget( currentView );
//viewActions[i_view]->setChecked( true );
browseInto();
gotoPlayingItem();
}
const int StandardPLPanel::getViewNumber()
{
if( currentView == treeView )
return TREE_VIEW;
else if( currentView == iconView )
return ICON_VIEW;
else if( currentView == listView )
return LIST_VIEW;
}
void StandardPLPanel::cycleViews()
{
if( currentView == iconView )
......
......@@ -70,6 +70,8 @@ public:
LIST_VIEW,
VIEW_COUNT };
const int getViewNumber();
protected:
PLModel *model;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment