Skip to content

Commit

Permalink
Fix for ticket #63.
Browse files Browse the repository at this point in the history
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@5188 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Apr 6, 2006
1 parent 5d44343 commit ba5d618
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
3 changes: 2 additions & 1 deletion src/gui/qgsmapoverviewcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
25 changes: 2 additions & 23 deletions src/gui/qgsproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ba5d618

Please sign in to comment.