mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-06 20:36:27 +00:00
Fix viewer load termination
Handle streamer success, failure, and cancellation as distinct terminal states so failed or cancelled loads do not finalize as successful models. Clean up partial model/UI state in the full and minimal viewer apps when a load is cancelled or fails. Generated with the assistance of an AI coding tool.
This commit is contained in:
@@ -45,6 +45,8 @@ MinimalWindow::MinimalWindow(QWidget* parent)
|
||||
this, &MinimalWindow::onLoadedFromSidecar);
|
||||
connect(loader_, &SceneLoader::loadedFromStream,
|
||||
this, &MinimalWindow::onLoadedFromStream);
|
||||
connect(loader_, &SceneLoader::loadCancelled,
|
||||
this, &MinimalWindow::onLoadCancelled);
|
||||
connect(loader_, &SceneLoader::loadError,
|
||||
this, &MinimalWindow::onLoadError);
|
||||
connect(loader_, &SceneLoader::allLoadsFinished,
|
||||
@@ -100,6 +102,11 @@ void MinimalWindow::onLoadedFromStream(uint32_t mid, qint64 elapsed_ms) {
|
||||
.arg(formatElapsed(elapsed_ms)));
|
||||
}
|
||||
|
||||
void MinimalWindow::onLoadCancelled(uint32_t mid) {
|
||||
status_label_->setText(QString("%1 load cancelled")
|
||||
.arg(loader_->displayName(mid)));
|
||||
}
|
||||
|
||||
void MinimalWindow::onLoadError(uint32_t /*mid*/, QString message) {
|
||||
qWarning("IfcViewerMinimal error: %s", qPrintable(message));
|
||||
status_label_->setText("Error: " + message);
|
||||
|
||||
@@ -40,6 +40,7 @@ private slots:
|
||||
void onLoadStarted(uint32_t mid, QString display_name);
|
||||
void onLoadedFromSidecar(uint32_t mid, qint64 elapsed_ms);
|
||||
void onLoadedFromStream(uint32_t mid, qint64 elapsed_ms);
|
||||
void onLoadCancelled(uint32_t mid);
|
||||
void onLoadError(uint32_t mid, QString message);
|
||||
void onAllLoadsFinished();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user