Skip to content

Commit

Permalink
Fix for bug whereby toggling layers on/off using the toggles in the
Browse files Browse the repository at this point in the history
menu wouldn't rexpect the globabl 'render' toggle setting. Compliments
closed ticket #149.


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5704 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Aug 17, 2006
1 parent b2ce7e9 commit cec5c94
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/legend/qgslegend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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)
{
Expand Down Expand Up @@ -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;
}
Expand All @@ -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)
{
Expand All @@ -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);
Expand Down

0 comments on commit cec5c94

Please sign in to comment.