Skip to content
Permalink
Browse files
use canvas names instead of open canvas names in new3DMapCanvas
  • Loading branch information
NEDJIMAbelgacem authored and nyalldawson committed Jan 12, 2022
1 parent b43d0a4 commit 2887049b48c0bc639613f89ab6a91efaa34c22ce
Showing with 4 additions and 15 deletions.
  1. +4 −15 src/app/qgisapp.cpp
@@ -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 );

0 comments on commit 2887049

Please sign in to comment.