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 | void WindowScriptingInterface::updateMessageBox(int id, QString title, QString text, int buttons, int defaultButton) { | 255 | void WindowScriptingInterface::updateMessageBox(int id, QString title, QString text, int buttons, int defaultButton) { |
| 256 | auto messageBox = _messageBoxes.value(id); | 256 | auto messageBox = _messageBoxes.value(id); |
| 257 | if (messageBox) { | 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 | messageBox->setProperty("title", title); | 268 | messageBox->setProperty("title", title); |
| 259 | messageBox->setProperty("text", text); | 269 | messageBox->setProperty("text", text); |
| 260 | messageBox->setProperty("buttons", buttons); | 270 | messageBox->setProperty("buttons", buttons); |
| @@ -265,6 +275,12 @@ void WindowScriptingInterface::updateMessageBox(int id, QString title, QString t · 4 unmodified lines | |||
| 265 | void WindowScriptingInterface::closeMessageBox(int id) { | 275 | void WindowScriptingInterface::closeMessageBox(int id) { |
| 266 | auto messageBox = _messageBoxes.value(id); | 276 | auto messageBox = _messageBoxes.value(id); |
| 267 | if (messageBox) { | 277 | if (messageBox) { |
| 278 | if (QThread::currentThread() != thread()) { | ||
| 279 | QMetaObject::invokeMethod(this, "closeMessageBox", | ||
| 280 | Q_ARG(int, id)); | ||
| 281 | return; | ||
| 282 | } | ||
| 283 | |||
| 268 | disconnect(messageBox); | 284 | disconnect(messageBox); |
| 269 | messageBox->setVisible(false); | 285 | messageBox->setVisible(false); |
| 270 | messageBox->deleteLater(); | 286 | messageBox->deleteLater(); |