File indexing completed on 2024-05-12 16:06:01

0001 #ifndef CLOSEDIALOGHELPER_H
0002 #define CLOSEDIALOGHELPER_H
0003 
0004 #include <QDialogButtonBox>
0005 #include <QObject>
0006 
0007 #include "../part/part.h"
0008 
0009 namespace TestingUtils
0010 {
0011 /*
0012  *  The CloseDialogHelper class is a helper to auto close modals opened in tests.
0013  */
0014 class CloseDialogHelper : public QObject
0015 {
0016     Q_OBJECT
0017 
0018 public:
0019     CloseDialogHelper(Okular::Part *p, QDialogButtonBox::StandardButton b);
0020 
0021     CloseDialogHelper(QWidget *w, QDialogButtonBox::StandardButton b);
0022 
0023     // Close a modal dialog, which may not be associated to any other widget
0024     explicit CloseDialogHelper(QDialogButtonBox::StandardButton b);
0025 
0026     ~CloseDialogHelper() override;
0027 
0028 private Q_SLOTS:
0029     void closeDialog();
0030 
0031 private:
0032     QWidget *m_widget;
0033     QDialogButtonBox::StandardButton m_button;
0034     bool m_clicked;
0035 };
0036 
0037 }
0038 
0039 #endif // CLOSEDIALOGHELPER_H