xref: /OK3568_Linux_fs/app/qsetting/qtkeyboard.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 #ifndef QKEYBOARD_H
2 #define QKEYBOARD_H
3 
4 //#include "basewidget.h"
5 
6 #include <QLabel>
7 #include <QLineEdit>
8 #include <QMouseEvent>
9 
10 namespace Ui
11 {
12 class QKeyBoard;
13 }
14 
15 class QKeyBoard : public QWidget
16 {
17     Q_OBJECT
18 public:
19     explicit QKeyBoard(QWidget *parent = nullptr);
20     ~QKeyBoard();
21 
getInstance()22     static QKeyBoard* getInstance()
23     {
24         if (!_instance) {
25             _instance = new QKeyBoard;
26         }
27         return _instance;
28     }
29 
30 private:
31     Ui::QKeyBoard *ui;
32     static QKeyBoard* _instance;
33     bool isShiftOn;
34     QLineEdit *lineEdit;
35     QPoint mousePoint;
36     bool mousePressed;
37 
38     void changeInputType(bool caps);
39     void showPanel();
40     void hidePanel();
41     void insertValue(const QString &value);
42 
43 protected:
44     void mouseMoveEvent(QMouseEvent *event);
45     void mouseReleaseEvent(QMouseEvent *event);
46     void mousePressEvent(QMouseEvent *event);
47 
48 private slots:
49     void slot_onApplicationFocusChanged(QWidget *, QWidget *);
50     void btn_clicked();
51 };
52 
53 #endif // QKEYBOARD_H
54