Skip to content
Permalink
Browse files

sort the indexes when generating layer tree mime data (fixes #4110)

  • Loading branch information
SebDieBln committed Dec 6, 2015
1 parent bf79ecc commit afef14bf3c57c9e4d257b65672b100c476618560
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.count() == 0 )
return 0;

0 comments on commit afef14b

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