Skip to content

Commit

Permalink
sort the indexes when generating layer tree mime data (fixes #4110)
Browse files Browse the repository at this point in the history
  • Loading branch information
SebDieBln committed Dec 6, 2015
1 parent bf79ecc commit afef14b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/layertree/qgslayertreemodel.cpp
Expand Up @@ -928,7 +928,11 @@ QStringList QgsLayerTreeModel::mimeTypes() const

QMimeData* QgsLayerTreeModel::mimeData( const QModelIndexList& indexes ) const
{
QList<QgsLayerTreeNode*> nodesFinal = indexes2nodes( indexes, true );
// Sort the indexes. Depending on how the user selected the items, the indexes may be unsorted.
QModelIndexList sortedIndexes = indexes;
qSort( sortedIndexes.begin(), sortedIndexes.end(), qLess<QModelIndex>() );

QList<QgsLayerTreeNode*> nodesFinal = indexes2nodes( sortedIndexes, true );

if ( nodesFinal.count() == 0 )
return 0;
Expand Down

0 comments on commit afef14b

Please sign in to comment.