2018-03-29 16:56:04 +02:00
|
|
|
#include <QApplication>
|
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QPushButton>
|
2018-10-20 10:33:45 +02:00
|
|
|
#include <QString>
|
|
|
|
#include <QTimer>
|
2018-03-29 16:56:04 +02:00
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
void ConfirmMessage(QString* text, int msec)
|
|
|
|
{
|
2018-10-20 10:33:45 +02:00
|
|
|
QTimer::singleShot(msec, [text]() {
|
2018-03-29 16:56:04 +02:00
|
|
|
for (QWidget* widget : QApplication::topLevelWidgets()) {
|
|
|
|
if (widget->inherits("QMessageBox")) {
|
|
|
|
QMessageBox* messageBox = qobject_cast<QMessageBox*>(widget);
|
|
|
|
if (text) *text = messageBox->text();
|
|
|
|
messageBox->defaultButton()->click();
|
|
|
|
}
|
|
|
|
}
|
2018-10-20 10:33:45 +02:00
|
|
|
});
|
2018-03-29 16:56:04 +02:00
|
|
|
}
|