7 #include <QApplication>
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();
void ConfirmMessage(QString *text, std::chrono::milliseconds msec)
Press "Ok" button in message box dialog.