PinYinHelper.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef PINYINHELPER_H
  2. #define PINYINHELPER_H
  3. #include <QObject>
  4. #include <QStringList>
  5. class DialogSoftKeyboard;
  6. class QLabel;
  7. class PinYinHelper : public QObject
  8. {
  9. Q_OBJECT
  10. public:
  11. explicit PinYinHelper(QObject *parent = 0);
  12. private:
  13. DialogSoftKeyboard *input;
  14. //当前拼音索引
  15. int pinyinIndex;
  16. //当前显示的汉字标签的数量
  17. int pinyinCount;
  18. //所有拼音链表
  19. QStringList pinyinAll;
  20. //拼音字母
  21. QString pinyin;
  22. //固定数量汉字标签数组(硬键盘展示用)
  23. QList<QLabel *>labCh;
  24. //顶部汉字标签数组
  25. QList<QLabel *>labCn;
  26. //更多汉字标签数组
  27. QList<QLabel *>labMore;
  28. public slots:
  29. void setInput(DialogSoftKeyboard *input);
  30. void setLabs(QList<QLabel *>labCh, QList<QLabel *>labCn, QList<QLabel *>labMore);
  31. //移动到合适的位置
  32. void movePosition();
  33. //查询汉字
  34. void selectChinese(const QString &pinyin);
  35. //显示查询到的汉字
  36. void showChinese();
  37. //上下翻页显示汉字
  38. void showPrevious();
  39. void showNext();
  40. //计算当前汉字长度自动隐藏标签
  41. void checkChinese(const QString &pinyin);
  42. void setChVisible(int index);
  43. //清空当前汉字信息
  44. void clearChinese();
  45. void hideChinese();
  46. };
  47. #endif // PINYINHELPER_H