Skip to content

Commit

Permalink
use canvas names instead of open canvas names in new3DMapCanvas
Browse files Browse the repository at this point in the history
  • Loading branch information
NEDJIMAbelgacem authored and nyalldawson committed Jan 12, 2022
1 parent b43d0a4 commit 2887049
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions src/app/qgisapp.cpp
Expand Up @@ -13992,22 +13992,11 @@ void QgisApp::new3DMapCanvas()
}

int i = 1;

bool existing = true;
const QList< Qgs3DMapCanvas * > existingCanvases = findChildren< Qgs3DMapCanvas * >();
QString name;
while ( existing )
const QList< QString > usedCanvasNames = QgsProject::instance()->views3DManager()->get3DViewsNames();
QString name = tr( "3D Map %1" ).arg( i );
while ( usedCanvasNames.contains( name ) )
{
name = tr( "3D Map %1" ).arg( i++ );
existing = false;
for ( Qgs3DMapCanvas *canvas : existingCanvases )
{
if ( canvas->objectName() == name )
{
existing = true;
break;
}
}
name = tr( "3D Map %1" ).arg( ++i );
}

Qgs3DMapCanvasDockWidget *dock = createNew3DMapCanvasDock( name );
Expand Down

0 comments on commit 2887049

Please sign in to comment.