Commit 6ccc5f15 authored by Filip Roséen's avatar Filip Roséen Committed by François Cartegnie

gui/qt: fix PLModel::action( ACTION_SORT, ... )

Given that one should always be able to sort the playlist, aborting sort
on "indexes.empty()" is inaccurate since we should not mandate that:

 - a user either right-clicks on an entity in order to sort, or;
 - has at least one index selected.

 This commit fixes the above described issue, as well as the arguments
 passed to PLModel::sort. More specifically, that the first argument is
 the first index (if any), and the second being the root index.
Signed-off-by: François Cartegnie's avatarFrancois Cartegnie <>
parent 39b5660b
......@@ -960,10 +960,10 @@ bool PLModel::action( QAction *action, const QModelIndexList &indexes )
return true;
if ( indexes.empty() ) break;
index = indexes.first().parent();
if( !index.isValid() ) index = rootIndex();
sort( indexes.first(), index,
if ( !indexes.empty() )
index = indexes.first();
sort( index, rootIndex(),
a.column > 0 ? a.column - 1 : -a.column - 1,
a.column > 0 ? Qt::AscendingOrder : Qt::DescendingOrder );
return true;
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