MCPcopy Create free account
hub / github.com/KDE/okular / closeMessageBox

Function closeMessageBox

autotests/jsfunctionstest.cpp:51–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49
50private Q_SLOTS:
51 void closeMessageBox()
52 {
53 const QWidgetList allToplevelWidgets = QApplication::topLevelWidgets();
54 QMessageBox *mb = nullptr;
55 for (QWidget *w : allToplevelWidgets) {
56 if (w->inherits("QMessageBox")) {
57 mb = qobject_cast<QMessageBox *>(w);
58 QCOMPARE(mb->text(), m_message);
59 QCOMPARE(mb->windowTitle(), m_title);
60 QCOMPARE(mb->icon(), m_icon);
61 QCheckBox *box = mb->checkBox();
62 QCOMPARE(box != nullptr, m_checkBox);
63 mb->button(m_button)->click();
64 }
65 }
66 if (!mb) {
67 QTimer::singleShot(0, this, &MessageBoxHelper::closeMessageBox);
68 return;
69 }
70 m_clicked = true;
71 }
72
73private:
74 QMessageBox::StandardButton m_button;

Callers

nothing calls this directly

Calls 2

textMethod · 0.45
iconMethod · 0.45

Tested by

no test coverage detected