From 8fb9ddcc279558889faed440615b06d6a2de2db2 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Thu, 19 Mar 2015 09:21:52 +0100 Subject: [PATCH] Use less Closure arguments. --- src/libtomahawk/playlist/PlaylistItemDelegate.cpp | 7 +++++-- src/libtomahawk/playlist/PlaylistItemDelegate.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libtomahawk/playlist/PlaylistItemDelegate.cpp b/src/libtomahawk/playlist/PlaylistItemDelegate.cpp index 62ef5b703..8d7a99ff6 100644 --- a/src/libtomahawk/playlist/PlaylistItemDelegate.cpp +++ b/src/libtomahawk/playlist/PlaylistItemDelegate.cpp @@ -147,7 +147,7 @@ PlaylistItemDelegate::createEditor( QWidget* parent, const QStyleOptionViewItem& editor->addItems( formats ); _detail::Closure* closure = NewClosure( editor, SIGNAL( activated( int ) ), - const_cast(this), SLOT( closeEditor( const QModelIndex&, PlayableItem*, QComboBox* ) ), index, item, editor ); + const_cast(this), SLOT( closeEditor( const QModelIndex&, QWidget* ) ), index, editor ); return editor; } @@ -156,8 +156,11 @@ PlaylistItemDelegate::createEditor( QWidget* parent, const QStyleOptionViewItem& void -PlaylistItemDelegate::closeEditor( const QModelIndex& index, PlayableItem* item, QComboBox* editor ) +PlaylistItemDelegate::closeEditor( const QModelIndex& index, QWidget* editor ) { + PlayableItem* item = m_model->itemFromIndex( m_model->mapToSource( index ) ); + Q_ASSERT( item ); + m_view->closePersistentEditor( index ); QComboBox* cb = static_cast< QComboBox* >(editor); diff --git a/src/libtomahawk/playlist/PlaylistItemDelegate.h b/src/libtomahawk/playlist/PlaylistItemDelegate.h index 1fbbdebbf..a87cec981 100644 --- a/src/libtomahawk/playlist/PlaylistItemDelegate.h +++ b/src/libtomahawk/playlist/PlaylistItemDelegate.h @@ -57,7 +57,7 @@ signals: private slots: void doUpdateIndex( const QPersistentModelIndex& index ); - void closeEditor( const QModelIndex& index, PlayableItem* item, QComboBox* editor ); + void closeEditor( const QModelIndex& index, QWidget* editor ); protected: void prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, PlayableItem* item ) const;