qtmaterialtextfield.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef QTMATERIALTEXTFIELD_H
  2. #define QTMATERIALTEXTFIELD_H
  3. #include <QtWidgets/QLineEdit>
  4. #include <QColor>
  5. class QtMaterialTextFieldPrivate;
  6. class QtMaterialTextField : public QLineEdit
  7. {
  8. Q_OBJECT
  9. Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor)
  10. Q_PROPERTY(QColor inkColor WRITE setInkColor READ inkColor)
  11. Q_PROPERTY(QColor inputLineColor WRITE setInputLineColor READ inputLineColor)
  12. public:
  13. explicit QtMaterialTextField(QWidget *parent = 0);
  14. ~QtMaterialTextField();
  15. void setUseThemeColors(bool value);
  16. bool useThemeColors() const;
  17. void setShowLabel(bool value);
  18. bool hasLabel() const;
  19. void setLabelFontSize(qreal size);
  20. qreal labelFontSize() const;
  21. void setLabel(const QString &label);
  22. QString label() const;
  23. void setTextColor(const QColor &color);
  24. QColor textColor() const;
  25. void setLabelColor(const QColor &color);
  26. QColor labelColor() const;
  27. void setInkColor(const QColor &color);
  28. QColor inkColor() const;
  29. void setInputLineColor(const QColor &color);
  30. QColor inputLineColor() const;
  31. void setShowInputLine(bool value);
  32. bool hasInputLine() const;
  33. protected:
  34. QtMaterialTextField(QtMaterialTextFieldPrivate &d, QWidget *parent = 0);
  35. bool event(QEvent *event) Q_DECL_OVERRIDE;
  36. void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
  37. const QScopedPointer<QtMaterialTextFieldPrivate> d_ptr;
  38. private:
  39. Q_DISABLE_COPY(QtMaterialTextField)
  40. Q_DECLARE_PRIVATE(QtMaterialTextField)
  41. };
  42. #endif // QTMATERIALTEXTFIELD_H