2019-12-07 18:14:40 +02:00
|
|
|
// Copyright (c) 2018 The Bitcoin Core developers
|
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2018-03-29 10:56:04 -04:00
|
|
|
#include <QApplication>
|
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QPushButton>
|
2018-10-20 05:33:45 -03:00
|
|
|
#include <QString>
|
|
|
|
#include <QTimer>
|
2018-03-29 10:56:04 -04:00
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
void ConfirmMessage(QString* text, int msec)
|
|
|
|
{
|
2018-10-20 05:33:45 -03:00
|
|
|
QTimer::singleShot(msec, [text]() {
|
2018-03-29 10:56:04 -04: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 05:33:45 -03:00
|
|
|
});
|
2018-03-29 10:56:04 -04:00
|
|
|
}
|