Skip to content
Permalink
Browse files

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
  • Loading branch information
g_j_m
g_j_m committed Apr 6, 2006
1 parent 5541461 commit 7e20a19d574e1d8fb86f9d7bde55d5de42933bd6
Showing with 4 additions and 24 deletions.
  1. +2 −1 src/gui/qgsmapoverviewcanvas.cpp
  2. +2 −23 src/gui/qgsproject.cpp
@@ -64,8 +64,9 @@ class QgsPanningWidget : public QWidget


QgsMapOverviewCanvas::QgsMapOverviewCanvas(QWidget * parent, QgsMapCanvas* mapCanvas)
: QWidget(parent, "theOverviewCanvas"), mMapCanvas(mapCanvas)
: QWidget(parent), mMapCanvas(mapCanvas)
{
setObjectName("theOverviewCanvas");
mPanningWidget = new QgsPanningWidget(this);

mMapRender = new QgsMapRender;
@@ -723,37 +723,15 @@ static QgsMapCanvas * _findMapCanvas(QString const &canonicalMapCanvasName)
{
QgsMapCanvas * theMapCanvas = 0x0;

// TODO: Need to refactor for Qt4 - uses QWidgetList only (no pointer-to)
#if QT_VERSION < 0x040000
QWidgetList *list = QApplication::topLevelWidgets();
QWidgetListIt it(*list); // iterate over the widgets
QWidget *w;

while ((w = it.current()) != 0)
{ // for each top level widget...
++it;
theMapCanvas =
dynamic_cast <QgsMapCanvas *>(w->child(canonicalMapCanvasName.toLocal8Bit().data(), 0, true));

if (theMapCanvas)
{
break;
}
}

delete list; // delete the list, not the widgets
#else
QWidgetList wlist = QApplication::topLevelWidgets();
foreach (QWidget *widget, QApplication::topLevelWidgets())
{
theMapCanvas = dynamic_cast <QgsMapCanvas *>(widget->child(canonicalMapCanvasName.toLocal8Bit().data(), 0, true));
theMapCanvas = dynamic_cast <QgsMapCanvas *>(widget->child(canonicalMapCanvasName));
if(theMapCanvas)
{
break;
}
}
#endif //QT_VERSION < 0x040000


if (theMapCanvas)
{
@@ -1123,6 +1101,7 @@ bool QgsProject::read()

// now set the map units; note, alters QgsProject::instance().
_getMapUnits(*doc);
_findMapCanvas("theMapCanvas")->setMapUnits(mapUnits());

// get the map layers
pair< bool, list<QDomNode> > getMapLayersResults = _getMapLayers(*doc);

0 comments on commit 7e20a19

Please sign in to comment.
You can’t perform that action at this time.