QtLineEditor.h 791 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #include <QObject>
  3. #include <qlineedit.h>
  4. class QtLineEditor : public QLineEdit
  5. {
  6. Q_OBJECT
  7. public:
  8. //constructor
  9. QtLineEditor(QWidget *parent = nullptr);
  10. //destructor
  11. ~QtLineEditor();
  12. //set a function to init the line edit
  13. void init(QString strText, bool isIntOrNot = true,int nMax = 255);
  14. //set a function to set the edit target
  15. void SetEditTarget(int* nTarget);
  16. //and set a overload function to set the edit target
  17. void SetEditTarget(QString* strTarget);
  18. //set a slot to process the text changed
  19. void OnTextChanged(const QString &text);
  20. //set a slot to process the text edited
  21. void OnTextEdited(const QString &text);
  22. public:
  23. //set a flags to sign the editor is Int or string
  24. bool m_bIsInt;
  25. //edit target
  26. int* m_nTarget;
  27. QString* m_strTarget;
  28. };