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