| 12 | #include <QWidget> |
| 13 | |
| 14 | void ConfirmMessage(QString* text, std::chrono::milliseconds msec) |
| 15 | { |
| 16 | QTimer::singleShot(msec, [text]() { |
| 17 | for (QWidget* widget : QApplication::topLevelWidgets()) { |
| 18 | if (widget->inherits("QMessageBox")) { |
| 19 | QMessageBox* messageBox = qobject_cast<QMessageBox*>(widget); |
| 20 | if (text) *text = messageBox->text(); |
| 21 | messageBox->defaultButton()->click(); |
| 22 | } |
| 23 | } |
| 24 | }); |
| 25 | } |
no outgoing calls
no test coverage detected