File tree Expand file tree Collapse file tree 2 files changed +4
-24
lines changed
Expand file tree Collapse file tree 2 files changed +4
-24
lines changed Original file line number Diff line number Diff line change @@ -64,8 +64,9 @@ class QgsPanningWidget : public QWidget
6464
6565
6666QgsMapOverviewCanvas::QgsMapOverviewCanvas (QWidget * parent, QgsMapCanvas* mapCanvas)
67- : QWidget(parent, " theOverviewCanvas " ), mMapCanvas(mapCanvas)
67+ : QWidget(parent), mMapCanvas(mapCanvas)
6868{
69+ setObjectName (" theOverviewCanvas" );
6970 mPanningWidget = new QgsPanningWidget (this );
7071
7172 mMapRender = new QgsMapRender;
Original file line number Diff line number Diff line change @@ -723,37 +723,15 @@ static QgsMapCanvas * _findMapCanvas(QString const &canonicalMapCanvasName)
723723{
724724 QgsMapCanvas * theMapCanvas = 0x0 ;
725725
726- // TODO: Need to refactor for Qt4 - uses QWidgetList only (no pointer-to)
727- #if QT_VERSION < 0x040000
728- QWidgetList *list = QApplication::topLevelWidgets ();
729- QWidgetListIt it (*list); // iterate over the widgets
730- QWidget *w;
731-
732- while ((w = it.current ()) != 0 )
733- { // for each top level widget...
734- ++it;
735- theMapCanvas =
736- dynamic_cast <QgsMapCanvas *>(w->child (canonicalMapCanvasName.toLocal8Bit ().data (), 0 , true ));
737-
738- if (theMapCanvas)
739- {
740- break ;
741- }
742- }
743-
744- delete list; // delete the list, not the widgets
745- #else
746726 QWidgetList wlist = QApplication::topLevelWidgets ();
747727 foreach (QWidget *widget, QApplication::topLevelWidgets ())
748728 {
749- theMapCanvas = dynamic_cast <QgsMapCanvas *>(widget->child (canonicalMapCanvasName. toLocal8Bit (). data (), 0 , true ));
729+ theMapCanvas = dynamic_cast <QgsMapCanvas *>(widget->child (canonicalMapCanvasName));
750730 if (theMapCanvas)
751731 {
752732 break ;
753733 }
754734 }
755- #endif // QT_VERSION < 0x040000
756-
757735
758736 if (theMapCanvas)
759737 {
@@ -1123,6 +1101,7 @@ bool QgsProject::read()
11231101
11241102 // now set the map units; note, alters QgsProject::instance().
11251103 _getMapUnits (*doc);
1104+ _findMapCanvas (" theMapCanvas" )->setMapUnits (mapUnits ());
11261105
11271106 // get the map layers
11281107 pair< bool , list<QDomNode> > getMapLayersResults = _getMapLayers (*doc);
You can’t perform that action at this time.
0 commit comments