Skip to content

Commit

Permalink
qgs3dmapcanvaswidget: Display a message to report export success state
Browse files Browse the repository at this point in the history
With this change, the messagebar is used to show a message if the
export operation failed or succeeded.
  • Loading branch information
ptitjano authored and lbartoletti committed Dec 18, 2024
1 parent fe4ca94 commit 8c4ffe5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/app/3d/qgs3dmapcanvaswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,18 @@ void Qgs3DMapCanvasWidget::exportScene()
layout->addWidget( &exportWidget, 1 );
layout->addWidget( buttons );
if ( dlg.exec() )
exportWidget.exportScene();
{
const bool success = exportWidget.exportScene();
const QString exportFilePath = QDir( exportSettings.sceneFolderPath() ).filePath( exportSettings.sceneName() + QStringLiteral( ".obj" ) );
if ( success )
{
mMessageBar->pushMessage( tr( "Export 3D scene" ), tr( "Successfully exported scene to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( exportFilePath ).toString(), QDir::toNativeSeparators( exportFilePath ) ), Qgis::MessageLevel::Success, 0 );
}
else
{
mMessageBar->pushMessage( tr( "Export 3D scene" ), tr( "Unable to export scene to <a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( exportFilePath ).toString(), QDir::toNativeSeparators( exportFilePath ) ), Qgis::MessageLevel::Warning, 0 );
}
}
}

void Qgs3DMapCanvasWidget::onMainCanvasLayersChanged()
Expand Down

0 comments on commit 8c4ffe5

Please sign in to comment.