Skip to content

Commit

Permalink
fix for map canvas not updated after layer file drag
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5314 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 19, 2006
1 parent a93e46b commit cb12f5f
Showing 1 changed file with 24 additions and 28 deletions.
52 changes: 24 additions & 28 deletions src/legend/qgslegend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,24 +279,22 @@ void QgsLegend::mouseReleaseEvent(QMouseEvent * e)
if(originType == QgsLegendItem::LEGEND_LAYER_FILE && destType == QgsLegendItem::LEGEND_LAYER_FILE_GROUP)
{
QgsMapLayer* origLayer = ((QgsLegendLayerFile*)(origin))->layer();
if(1) //todo: find a test to avoid that symbology settings are copied if an item is moved within the same legend layer
if(dest->childCount() > 1)
{
if(dest->childCount() > 1)
//find the first layer in the legend layer group != origLayer and copy its settings
QgsLegendItem* currentItem = dynamic_cast<QgsLegendItem*>(dest->child(0));
while(currentItem)
{
//find the first layer in the legend layer group != origLayer and copy its settings
QgsLegendItem* currentItem = dynamic_cast<QgsLegendItem*>(dest->child(0));
while(currentItem)
if(currentItem != origin)
{
if(currentItem != origin)
{
QgsMapLayer* origLayer = ((QgsLegendLayerFile*)(origin))->layer();
QgsMapLayer* currentLayer = ((QgsLegendLayerFile*)(currentItem))->layer();
origLayer->copySymbologySettings(*currentLayer);
break;
}
currentItem = currentItem->nextSibling();
QgsMapLayer* origLayer = ((QgsLegendLayerFile*)(origin))->layer();
QgsMapLayer* currentLayer = ((QgsLegendLayerFile*)(currentItem))->layer();
origLayer->copySymbologySettings(*currentLayer);
break;
}
}
currentItem = currentItem->nextSibling();
}
mMapCanvas->refresh();
}
}
else if(originType == QgsLegendItem::LEGEND_LAYER_FILE && destType == QgsLegendItem::LEGEND_LAYER_FILE)
Expand All @@ -306,24 +304,22 @@ void QgsLegend::mouseReleaseEvent(QMouseEvent * e)

if(dest == origin)//origin item has been moved in mouseMoveEvent such that it is under the mouse cursor now
{
if(1) //todo: find a test to avoid that symbology settings are copied if an item is moved within the same legend layer
{
if(origin->parent()->childCount() > 1)
if(origin->parent()->childCount() > 1)
{
//find the first layer in the legend layer group != origLayer and copy its settings
QTreeWidgetItem* currentItem = dest->parent()->child(0);
while(currentItem)
{
//find the first layer in the legend layer group != origLayer and copy its settings
QTreeWidgetItem* currentItem = dest->parent()->child(0);
while(currentItem)
if(currentItem != origin)
{
if(currentItem != origin)
{
QgsMapLayer* origLayer = ((QgsLegendLayerFile*)(origin))->layer();
QgsMapLayer* currentLayer = ((QgsLegendLayerFile*)(currentItem))->layer();
origLayer->copySymbologySettings(*currentLayer);
break;
}
currentItem = dynamic_cast<QgsLegendItem*>(currentItem)->nextSibling();
QgsMapLayer* origLayer = ((QgsLegendLayerFile*)(origin))->layer();
QgsMapLayer* currentLayer = ((QgsLegendLayerFile*)(currentItem))->layer();
origLayer->copySymbologySettings(*currentLayer);
break;
}
currentItem = dynamic_cast<QgsLegendItem*>(currentItem)->nextSibling();
}
mMapCanvas->refresh();
}
}
else
Expand Down

0 comments on commit cb12f5f

Please sign in to comment.