Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -21,6 +21,7 @@ · 20 unmodified lines | ||
| 21 | 21 | #include "DomainHandler.h" |
| 22 | 22 | #include "MainWindow.h" |
| 23 | 23 | #include "Menu.h" |
| 24 | +#include "OffscreenUi.h" | |
| 24 | 25 | #include "ui/ModelsBrowser.h" |
| 25 | 26 | |
| 26 | 27 | #include "WindowScriptingInterface.h" |
| @@ -153,12 +154,11 @@ QScriptValue WindowScriptingInterface::peekNonBlockingFormResult(QScriptValue fo · 126 unmodified lines | ||
| 153 | 154 | return retVal; |
| 154 | 155 | } |
| 155 | 156 | |
| 156 | − | |
| 157 | 157 | /// Display an alert box |
| 158 | 158 | /// \param const QString& message message to display |
| 159 | 159 | /// \return QScriptValue::UndefinedValue |
| 160 | 160 | QScriptValue WindowScriptingInterface::showAlert(const QString& message) { |
| 161 | − QMessageBox::warning(qApp->getWindow(), "", message); | |
| 161 | + OffscreenUi::warning("", message); | |
| 162 | 162 | return QScriptValue::UndefinedValue; |
| 163 | 163 | } |
| 164 | 164 | |
| @@ -166,8 +166,16 @@ QScriptValue WindowScriptingInterface::showAlert(const QString& message) { · 1 unmodified line | ||
| 166 | 166 | /// \param const QString& message message to display |
| 167 | 167 | /// \return QScriptValue `true` if 'Yes' was clicked, `false` otherwise |
| 168 | 168 | QScriptValue WindowScriptingInterface::showConfirm(const QString& message) { |
| 169 | − QMessageBox::StandardButton response = QMessageBox::question(qApp->getWindow(), "", message); | |
| 170 | − return QScriptValue(response == QMessageBox::Yes); | |
| 169 | + bool confirm = false; | |
| 170 | + bool waiting = true; | |
| 171 | + OffscreenUi::question("", message, [&](QMessageBox::StandardButton response){ | |
| 172 | + confirm = (response == QMessageBox::Yes); | |
| 173 | + waiting = false; | |
| 174 | + }); | |
| 175 | + while (waiting) { | |
| 176 | + QCoreApplication::processEvents(); | |
| 177 | + } | |
| 178 | + return QScriptValue(confirm); | |
| 171 | 179 | } |
| 172 | 180 | |
| 173 | 181 | void WindowScriptingInterface::chooseDirectory() { |
| @@ -597,7 +605,6 @@ QScriptValue WindowScriptingInterface::showPrompt(const QString& message, const · 423 unmodified lines | ||
| 597 | 605 | if (promptDialog.exec() == QDialog::Accepted) { |
| 598 | 606 | return QScriptValue(promptDialog.textValue()); |
| 599 | 607 | } |
| 600 | − | |
| 601 | 608 | return QScriptValue::NullValue; |
| 602 | 609 | } |
| 603 | 610 | |