knossos-project / knossos

KNOSSOS is a software tool for the visualization and annotation of 3D image data and was developed for the rapid reconstruction of neural morphology and connectivity.
https://knossos.app
GNU General Public License v2.0
72 stars 18 forks source link

Bad message box positions for clearing annotation on dataset change #442

Open my-tien opened 6 years ago

my-tien commented 6 years ago

Message box on dataset load widget: image

Click on “Start new one”

Message box in center of screen: image

It’s annoying that I have to move the cursor because of this.

my-tien commented 6 years ago

This occurs every time when I switch datasets, because I always load multiple skeletons which automatically causes unsaved changes.

Optiligence commented 6 years ago

:thinking:

image

It’s a gnome issue, for a short time after a dialog closes no window has focus leaving the second dialog orphan.

You can use the keyboard. :wink:

28 ^^

diff --git a/widgets/datasetloadwidget.cpp b/widgets/datasetloadwidget.cpp
index a45e836f..a674c3dc 100644
--- a/widgets/datasetloadwidget.cpp
+++ b/widgets/datasetloadwidget.cpp
@@ -273,6 +273,9 @@ bool DatasetLoadWidget::loadDataset(const boost::optional<bool> loadOverlay, QUr
         const auto * const clearButton = question.addButton(tr("Start &new one"), QMessageBox::RejectRole);
         const auto * const cancelButton = question.addButton(QMessageBox::Cancel);
         question.exec();
+        QApplication::processEvents();
+        activateWindow();// QThread::msleep(10); also works
+        QApplication::processEvents();
         if (question.clickedButton() == cancelButton || (question.clickedButton() == clearButton && !state->viewer->window->newAnnotationSlot())) {// clear skeleton, mergelist and snappy cubes
             return false;
         }