Skip to content

Commit

Permalink
fix to enable saving/loading of legend again
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@5038 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Mar 16, 2006
1 parent f641c58 commit af95217
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/gui/qgisapp.cpp
Expand Up @@ -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;
Expand Down
12 changes: 7 additions & 5 deletions src/gui/qgsproject.cpp
Expand Up @@ -38,7 +38,8 @@ using namespace std;
#include <QWidget>
#include <QObject>
#include <QTextStream>

#include <QToolBox>
#include <QSplitter>


static const char *const ident_ = "$Id$";
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit af95217

Please sign in to comment.