Skip to content
Permalink
Browse files

Merge pull request #2543 from SebDieBln/SortLayerTreeMimedata

Sort the indexes when generating layer tree mime data (fixes #4110)
  • Loading branch information
NathanW2 committed Dec 14, 2015
2 parents 805d9d4 + afef14b commit b64ebfb2e25cf6c5eca12ead2e2f2b1f2dbe1376
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/core/layertree/qgslayertreemodel.cpp
@@ -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.isEmpty() )
return 0;

0 comments on commit b64ebfb

Please sign in to comment.
You can’t perform that action at this time.