Showing the changes to interface/src/scripting/WindowScriptingInterface.cpp (1 of 5 files). Show all
Unified · Split
| @@ -255,6 +255,16 @@ int WindowScriptingInterface::createMessageBox(QString title, QString text, int · 254 unmodified lines | ||
| 255 | 255 | void WindowScriptingInterface::updateMessageBox(int id, QString title, QString text, int buttons, int defaultButton) { |
| 256 | 256 | auto messageBox = _messageBoxes.value(id); |
| 257 | 257 | if (messageBox) { |
| 258 | + if (QThread::currentThread() != thread()) { | |
| 259 | + QMetaObject::invokeMethod(this, "updateMessageBox", | |
| 260 | + Q_ARG(int, id), | |
| 261 | + Q_ARG(QString, title), | |
| 262 | + Q_ARG(QString, text), | |
| 263 | + Q_ARG(int, buttons), | |
| 264 | + Q_ARG(int, defaultButton)); | |
| 265 | + return; | |
| 266 | + } | |
| 267 | + | |
| 258 | 268 | messageBox->setProperty("title", title); |
| 259 | 269 | messageBox->setProperty("text", text); |
| 260 | 270 | messageBox->setProperty("buttons", buttons); |
| @@ -265,6 +275,12 @@ void WindowScriptingInterface::updateMessageBox(int id, QString title, QString t · 4 unmodified lines | ||
| 265 | 275 | void WindowScriptingInterface::closeMessageBox(int id) { |
| 266 | 276 | auto messageBox = _messageBoxes.value(id); |
| 267 | 277 | if (messageBox) { |
| 278 | + if (QThread::currentThread() != thread()) { | |
| 279 | + QMetaObject::invokeMethod(this, "closeMessageBox", | |
| 280 | + Q_ARG(int, id)); | |
| 281 | + return; | |
| 282 | + } | |
| 283 | + | |
| 268 | 284 | disconnect(messageBox); |
| 269 | 285 | messageBox->setVisible(false); |
| 270 | 286 | messageBox->deleteLater(); |