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
64
64
65
65
66
66
QgsMapOverviewCanvas::QgsMapOverviewCanvas (QWidget * parent, QgsMapCanvas* mapCanvas)
67
- : QWidget(parent, " theOverviewCanvas " ), mMapCanvas(mapCanvas)
67
+ : QWidget(parent), mMapCanvas(mapCanvas)
68
68
{
69
+ setObjectName (" theOverviewCanvas" );
69
70
mPanningWidget = new QgsPanningWidget (this );
70
71
71
72
mMapRender = new QgsMapRender;
Original file line number Diff line number Diff line change @@ -723,37 +723,15 @@ static QgsMapCanvas * _findMapCanvas(QString const &canonicalMapCanvasName)
723
723
{
724
724
QgsMapCanvas * theMapCanvas = 0x0 ;
725
725
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
746
726
QWidgetList wlist = QApplication::topLevelWidgets ();
747
727
foreach (QWidget *widget, QApplication::topLevelWidgets ())
748
728
{
749
- theMapCanvas = dynamic_cast <QgsMapCanvas *>(widget->child (canonicalMapCanvasName. toLocal8Bit (). data (), 0 , true ));
729
+ theMapCanvas = dynamic_cast <QgsMapCanvas *>(widget->child (canonicalMapCanvasName));
750
730
if (theMapCanvas)
751
731
{
752
732
break ;
753
733
}
754
734
}
755
- #endif // QT_VERSION < 0x040000
756
-
757
735
758
736
if (theMapCanvas)
759
737
{
@@ -1123,6 +1101,7 @@ bool QgsProject::read()
1123
1101
1124
1102
// now set the map units; note, alters QgsProject::instance().
1125
1103
_getMapUnits (*doc);
1104
+ _findMapCanvas (" theMapCanvas" )->setMapUnits (mapUnits ());
1126
1105
1127
1106
// get the map layers
1128
1107
pair< bool , list<QDomNode> > getMapLayersResults = _getMapLayers (*doc);
You can’t perform that action at this time.
0 commit comments