hc
2024-08-12 233ab1bd4c5697f5cdec94e60206e8c6ac609b4c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef NETCONNECTDIALOG_H
#define NETCONNECTDIALOG_H
 
#include <QLabel>
#include <QDialog>
#include <QLineEdit>
#include <QEventLoop>
#include <QPushButton>
 
class inputDialog : public QDialog
{
    Q_OBJECT
public:
    inputDialog(QWidget *parent = nullptr);
    ~inputDialog();
    static inputDialog* getInstance(QWidget *parent = nullptr)
    {
        if (!_instance) {
            _instance = new inputDialog;
        }
        return _instance;
    }
    void setText(QString yes, QString no, QString text);
    QString getEditText(){return wordEdit->text();}
    int exec();
    bool isRunning();
    void exit(bool result);
 
private:
    static inputDialog* _instance;
    QLabel *nameLabel;
    QLineEdit *wordEdit;
    QPushButton yBtn;
    QPushButton nBtn;
    QEventLoop* m_eventLoop;
    bool m_chooseResult;
 
protected:
    void closeEvent(QCloseEvent *);
 
private slots:
    void slot_onApplicationFocusChanged(QWidget *, QWidget *);
    void slot_onYesClicked();
    void slot_onNoClicked();
};
 
#endif // NETCONNECTDIALOG_H