Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright (c) 2011-2015 The Starwels developers
  2. // Distributed under the MIT software license, see the accompanying
  3. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
  4. #ifndef STARWELS_QT_QVALIDATEDLINEEDIT_H
  5. #define STARWELS_QT_QVALIDATEDLINEEDIT_H
  6. #include <QLineEdit>
  7. /** Line edit that can be marked as "invalid" to show input validation feedback. When marked as invalid,
  8. it will get a red background until it is focused.
  9. */
  10. class QValidatedLineEdit : public QLineEdit
  11. {
  12. Q_OBJECT
  13. public:
  14. explicit QValidatedLineEdit(QWidget *parent);
  15. void clear();
  16. void setCheckValidator(const QValidator *v);
  17. bool isValid();
  18. protected:
  19. void focusInEvent(QFocusEvent *evt);
  20. void focusOutEvent(QFocusEvent *evt);
  21. private:
  22. bool valid;
  23. const QValidator *checkValidator;
  24. public Q_SLOTS:
  25. void setValid(bool valid);
  26. void setEnabled(bool enabled);
  27. Q_SIGNALS:
  28. void validationDidChange(QValidatedLineEdit *validatedLineEdit);
  29. private Q_SLOTS:
  30. void markValid();
  31. void checkValidity();
  32. };
  33. #endif // STARWELS_QT_QVALIDATEDLINEEDIT_H