Skip to content

Commit

Permalink
qgisapp now uses QgsLegend::currentLayer() instead of parsing list items
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@4293 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Dec 6, 2005
1 parent 8f1ce4f commit 4ca202d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
30 changes: 12 additions & 18 deletions src/qgisapp.cpp
Expand Up @@ -3401,24 +3401,18 @@ void QgisApp::inOverview( bool in_overview )
std::cout << "QGisApp::inOverview(" << in_overview << ")" << std::endl;
#endif

QTreeWidgetItem* lvi = mMapLegend->currentItem();

// check to make sure there is a current layer
// TODO: We really need to set disable/enable all menu options based on a logical scheme.
// This is just a hack...
if(lvi)
{
QgsLegendLayerFile* llf = dynamic_cast<QgsLegendLayerFile*>(lvi);
if(llf)
{
QgsMapLayer *layer = llf->layer();
layer->inOverview( in_overview );
// For Qt4, deprecate direct calling of render(). Let render() be called by the
// paint event loop of the overview canvas widget.
// mOverviewCanvas->render();
mOverviewCanvas->update();
}
}
QgsMapLayer* layer = mMapLegend->currentLayer();
if(layer)
{
layer->inOverview( in_overview );

// For Qt4, deprecate direct calling of render(). Let render() be called by the
// paint event loop of the overview canvas widget.

//but adding a layer to overview canvas does only work at the moment when calling render()...
mOverviewCanvas->render();
//mOverviewCanvas->update();
}
} // QgisApp::inOverview(bool)


Expand Down
3 changes: 2 additions & 1 deletion src/qgsrenderer.cpp
Expand Up @@ -26,7 +26,7 @@ void QgsRenderer::refreshLegend(QTreeWidgetItem* legendparent) const
QString lw, uv, label;
const std::list<QgsSymbol*> sym = symbols();

for(std::list<QgsSymbol*>::const_reverse_iterator it=sym.rbegin(); it!=sym.rend(); ++it)
for(std::list<QgsSymbol*>::const_iterator it=sym.begin(); it!=sym.end(); ++it)
{
QgsLegendVectorSymbologyItem* item = new QgsLegendVectorSymbologyItem(legendparent, "");
item->addSymbol(*it);
Expand Down Expand Up @@ -67,6 +67,7 @@ void QgsRenderer::refreshLegend(QTreeWidgetItem* legendparent) const
}
item->setText(0, values);
}
//todo: add the name(s) of the classification field
}
}

0 comments on commit 4ca202d

Please sign in to comment.