File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -1118,8 +1118,8 @@ void QgisApp::createOverview()
1118
1118
void QgisApp::createLegend ()
1119
1119
{
1120
1120
// legend
1121
- // mMapLegend = new QgsLegend(this,NULL, "theMapLegend");
1122
- mMapLegend = new QgsLegend ( this , this , " theMapLegend" );
1121
+ mMapLegend = new QgsLegend (this ,NULL , " theMapLegend" );
1122
+ mMapLegend -> setObjectName ( " theMapLegend" );
1123
1123
mMapLegend ->setMapCanvas (mMapCanvas );
1124
1124
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." ));
1125
1125
QVBoxLayout *myLegendLayout = new QVBoxLayout;
Original file line number Diff line number Diff line change @@ -38,7 +38,8 @@ using namespace std;
38
38
#include < QWidget>
39
39
#include < QObject>
40
40
#include < QTextStream>
41
-
41
+ #include < QToolBox>
42
+ #include < QSplitter>
42
43
43
44
44
45
static const char *const ident_ = " $Id$" ;
@@ -771,15 +772,16 @@ static QgsMapCanvas * _findMapCanvas(QString const &canonicalMapCanvasName)
771
772
static QgsLegend * _findLegend ()
772
773
{
773
774
QString canonicalLegendName = " theMapLegend" ;
774
- QgsLegend* theLegend = NULL ;
775
+ QgsLegend* theLegend = 0 ;
775
776
776
777
QWidgetList wlist = QApplication::topLevelWidgets ();
777
778
foreach (QWidget *widget, QApplication::topLevelWidgets ())
778
779
{
779
- // theLegend = dynamic_cast <QgsLegend *>(widget->child(canonicalLegendName.toLocal8Bit().data(), 0, true));
780
- theLegend = widget->findChild <QgsLegend*>(" theMapLegend" );
780
+ theLegend = dynamic_cast <QgsLegend *>(widget->child (canonicalLegendName.toLocal8Bit ().data (), 0 , true ));
781
781
if (theLegend)
782
- break ;
782
+ {
783
+ break ;
784
+ }
783
785
}
784
786
785
787
return theLegend;
You can’t perform that action at this time.
0 commit comments