Skip to content
Permalink
Browse files
Fix for bug whereby toggling layers on/off using the toggles in the
menu wouldn't rexpect the globabl 'render' toggle setting. Compliments
closed ticket #149.


git-svn-id: http://svn.osgeo.org/qgis/trunk@5704 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Aug 17, 2006
1 parent fce6603 commit f5433e853df9b1cf1caf9f773d172f2c740b9984
Showing with 14 additions and 3 deletions.
  1. +14 −3 src/legend/qgslegend.cpp
@@ -1488,7 +1488,10 @@ void QgsLegend::handleItemChange(QTreeWidgetItem* item, int row)
}
}
mStateOfCheckBoxes[item] = item->checkState(0);
mMapCanvas->setRenderFlag(true);
// Setting the renderFlag to true will trigger a render,
// so only do this if the flag is alread set to true.
if (mMapCanvas->renderFlag())
mMapCanvas->setRenderFlag(true);
return;
}

@@ -1498,6 +1501,7 @@ void QgsLegend::handleItemChange(QTreeWidgetItem* item, int row)
{
//set all the child layer files to the new check state
subfiles = lg->legendLayerFiles();
bool renderFlagState = mMapCanvas->renderFlag();
mMapCanvas->setRenderFlag(false);
for(std::list<QgsLegendLayerFile*>::iterator iter = subfiles.begin(); iter != subfiles.end(); ++iter)
{
@@ -1531,7 +1535,10 @@ void QgsLegend::handleItemChange(QTreeWidgetItem* item, int row)
static_cast<QgsLegendLayer*>(lg->child(i))->updateCheckState();
mStateOfCheckBoxes[lg->child(i)] = lg->child(i)->checkState(0);
}
mMapCanvas->setRenderFlag(true);
// If it was on, turn it back on, otherwise leave it
// off, as turning it on causes a refresh.
if (renderFlagState)
mMapCanvas->setRenderFlag(true);
mStateOfCheckBoxes[item] = item->checkState(0);
return;
}
@@ -1541,6 +1548,7 @@ void QgsLegend::handleItemChange(QTreeWidgetItem* item, int row)
{
//set all the child layer files to the new check state
subfiles = ll->legendLayerFiles();
bool renderFlagState = mMapCanvas->renderFlag();
mMapCanvas->setRenderFlag(false);
for(std::list<QgsLegendLayerFile*>::iterator iter = subfiles.begin(); iter != subfiles.end(); ++iter)
{
@@ -1558,7 +1566,10 @@ void QgsLegend::handleItemChange(QTreeWidgetItem* item, int row)
static_cast<QgsLegendGroup*>(ll->parent())->updateCheckState();
mStateOfCheckBoxes[ll->parent()] = ll->parent()->checkState(0);
}
mMapCanvas->setRenderFlag(true);
// If it was on, turn it back on, otherwise leave it
// off, as turning it on causes a refresh.
if (renderFlagState)
mMapCanvas->setRenderFlag(true);
//update check state of the legend group
}
mStateOfCheckBoxes[item] = item->checkState(0);

0 comments on commit f5433e8

Please sign in to comment.