Skip to content
Permalink
Browse files

fix to enable saving/loading of legend again

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5038 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Mar 16, 2006
1 parent 70bcd48 commit 770464d5ef3ca53577f8c32c2cc8ac32d5672a4c
Showing with 9 additions and 7 deletions.
  1. +2 −2 src/gui/qgisapp.cpp
  2. +7 −5 src/gui/qgsproject.cpp
@@ -1118,8 +1118,8 @@ void QgisApp::createOverview()
void QgisApp::createLegend()
{
//legend
//mMapLegend = new QgsLegend(this,NULL, "theMapLegend");
mMapLegend = new QgsLegend(this, this, "theMapLegend");
mMapLegend = new QgsLegend(this,NULL, "theMapLegend");
mMapLegend->setObjectName("theMapLegend");
mMapLegend->setMapCanvas(mMapCanvas);
QWhatsThis::add(mMapLegend, tr("Map legend that displays all the layers currently on the map canvas. Click on the check box to turn a layer on or off. Double click on a layer in the legend to customize its appearance and set other properties."));
QVBoxLayout *myLegendLayout = new QVBoxLayout;
@@ -38,7 +38,8 @@ using namespace std;
#include <QWidget>
#include <QObject>
#include <QTextStream>

#include <QToolBox>
#include <QSplitter>


static const char *const ident_ = "$Id$";
@@ -771,15 +772,16 @@ static QgsMapCanvas * _findMapCanvas(QString const &canonicalMapCanvasName)
static QgsLegend * _findLegend()
{
QString canonicalLegendName = "theMapLegend";
QgsLegend* theLegend = NULL;
QgsLegend* theLegend = 0;

QWidgetList wlist = QApplication::topLevelWidgets();
foreach (QWidget *widget, QApplication::topLevelWidgets())
{
//theLegend = dynamic_cast <QgsLegend *>(widget->child(canonicalLegendName.toLocal8Bit().data(), 0, true));
theLegend = widget->findChild<QgsLegend*>("theMapLegend");
theLegend = dynamic_cast <QgsLegend *>(widget->child(canonicalLegendName.toLocal8Bit().data(), 0, true));
if(theLegend)
break;
{
break;
}
}

return theLegend;

0 comments on commit 770464d

Please sign in to comment.
You can’t perform that action at this time.