Bitcoin Core  22.99.0
P2P Digital Currency
util.cpp
Go to the documentation of this file.
1 // Copyright (c) 2018-2020 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 <QApplication>
6 #include <QMessageBox>
7 #include <QPushButton>
8 #include <QString>
9 #include <QTimer>
10 #include <QWidget>
11 
12 void ConfirmMessage(QString* text, int msec)
13 {
14  QTimer::singleShot(msec, [text]() {
15  for (QWidget* widget : QApplication::topLevelWidgets()) {
16  if (widget->inherits("QMessageBox")) {
17  QMessageBox* messageBox = qobject_cast<QMessageBox*>(widget);
18  if (text) *text = messageBox->text();
19  messageBox->defaultButton()->click();
20  }
21  }
22  });
23 }
ConfirmMessage
void ConfirmMessage(QString *text, int msec)
Press "Ok" button in message box dialog.
Definition: util.cpp:12