#ifndef KEYBOARD_H #define KEYBOARD_H #include #include #include #include //chinese support #include #include #include #include class keyboard : public QDialog { Q_OBJECT public: typedef enum { enKeyboardNotGen, enKeyboardCreating, enKeyboardCreated }enKeyboardStatus; static const int KEYS_QUANTITY_MAX = 60; static const int SPACE = 5; static const int ROW_NUM = 6; static keyboard* GetInstance(QWidget *parent); static void preLoad(); static void close(); ~keyboard(); void popup(const int posToBottom = 0); signals: void signalWordChoose(QString word); public slots: void slotBtnClicked(); void slotBtnPressed(); void slotBtnReleased(); void slotPageTurnBtnClicked(); void slotCandidateBtnClicked(); void slotClose(); void slotTimer(); private: static keyboard* m_instance; QObject* m_receiver; static enKeyboardStatus m_status; QPushButton* m_btn[KEYS_QUANTITY_MAX]; //chinese support QVector m_btnsCnCdd; QLineEdit* m_editCn; QPushButton* m_btnCnPrePage; QPushButton* m_btnCnNextPage; static QFile* m_pinyinFile; static QRegExp* m_regExp; static QMultiMap* m_pinyinMap; bool isInputMethodCn; int m_iCddPageIndex; QList m_pinyinList; QLabel* m_labelTip; QTimer* m_timer; QPushButton* m_curPressedKey; explicit keyboard(QWidget *parent = nullptr); void setInputMethodCn(bool setCn); void matching(const QString& userInput); void changePage(int index); void setReceiver(QObject*); QObject* receiver() const; void shiftkeyboard(int caps); void paintEvent(QPaintEvent *event); void keyPress(const QPushButton* btn); }; #endif // KEYBOARD_H