Bitcoin Core 28.99.0
P2P Digital Currency
util.cpp
Go to the documentation of this file.
1// Copyright (c) 2018-2022 The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#include <qt/test/util.h>
6
7#include <chrono>
8
9#include <QApplication>
10#include <QMessageBox>
11#include <QPushButton>
12#include <QString>
13#include <QTimer>
14#include <QWidget>
15
16void ConfirmMessage(QString* text, std::chrono::milliseconds msec)
17{
18 QTimer::singleShot(msec, [text]() {
19 for (QWidget* widget : QApplication::topLevelWidgets()) {
20 if (widget->inherits("QMessageBox")) {
21 QMessageBox* messageBox = qobject_cast<QMessageBox*>(widget);
22 if (text) *text = messageBox->text();
23 messageBox->defaultButton()->click();
24 }
25 }
26 });
27}
void ConfirmMessage(QString *text, std::chrono::milliseconds msec)
Press "Ok" button in message box dialog.
Definition: util.cpp:16