File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -242,7 +242,6 @@ void QgsLegend::mouseMoveEvent(QMouseEvent * e)
242
242
}
243
243
}
244
244
}
245
- // QTreeWidget::mouseMoveEvent(e);
246
245
}
247
246
248
247
void QgsLegend::mouseReleaseEvent (QMouseEvent * e)
@@ -325,7 +324,13 @@ void QgsLegend::mouseReleaseEvent(QMouseEvent * e)
325
324
origLayer->setLegend ((QgsLegend*)(dynamic_cast <QgsLegendItem*>(dest->parent ())->nextSibling ()));
326
325
}
327
326
}
328
- emit zOrderChanged (this );
327
+
328
+ std::deque<QString> layersAfterRelease = layerIDs (); // test if canvas redraw is really necessary
329
+ if (layersAfterRelease != mLayersPriorToMove )
330
+ {
331
+ emit zOrderChanged (this );
332
+ }
333
+
329
334
}
330
335
}
331
336
mMousePressedFlag = false ;
@@ -989,6 +994,7 @@ void QgsLegend::storeInitialPosition(QTreeWidgetItem* li)
989
994
mRestoreInformation = YOUNGER_SIBLING;
990
995
mRestoreItem = ((QgsLegendItem*)(li))->findYoungerSibling ();
991
996
}
997
+ mLayersPriorToMove = layerIDs ();
992
998
}
993
999
994
1000
void QgsLegend::resetToInitialPosition (QTreeWidgetItem* li)
Original file line number Diff line number Diff line change @@ -222,6 +222,7 @@ this item may be moved back to the original position with resetToInitialPosition
222
222
/* *Returns the legend layer to which a map layer gelongs*/
223
223
QgsLegendLayer* findLegendLayer (const QString& layerKey);
224
224
225
+
225
226
private slots:
226
227
227
228
/* *Calls 'handleRightClickEvent' on the item*/
@@ -294,6 +295,10 @@ this item may be moved back to the original position with resetToInitialPosition
294
295
295
296
bool mShowLegendLayerFiles ;
296
297
298
+ /* *Stores the layer ordering before a mouse Move. After the move, this is used to
299
+ decide if the mapcanvas really has to be refreshed*/
300
+ std::deque<QString> mLayersPriorToMove ;
301
+
297
302
/* !
298
303
* A fuction sed to determin how far down in the list an item is (starting with one for the first Item.
299
304
*If the item is not in the legend, -1 is returned
You can’t perform that action at this time.
0 commit comments