Skip to content

Commit 7e20a19

Browse files
author
g_j_m
committedApr 6, 2006
Fix for ticket #63.
Plus bonus fixes: - Removal of some Qt3 #ifdef'd code - Fixed an error in the constructor for the QWidget in QgsMapOverviewCanvas - Attempt to set the name of the QgsMapOverviewCanvas (doesn't seem to work). git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5188 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

2 files changed

+4
-24
lines changed

2 files changed

+4
-24
lines changed
 

‎src/gui/qgsmapoverviewcanvas.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ class QgsPanningWidget : public QWidget
6464

6565

6666
QgsMapOverviewCanvas::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;

‎src/gui/qgsproject.cpp

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)
Please sign in to comment.