QAntPrimaryButton.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //
  2. // Created by Louis on 25-4-1.
  3. //
  4. #ifndef QANTPRIMARYBUTTON_H
  5. #define QANTPRIMARYBUTTON_H
  6. #include "QAntAbstractButton.h"
  7. #include <QPainterPath>
  8. #include <QtDesigner/QDesignerExportWidget>
  9. class QAntPrimaryButton : public QAntAbstractButton{
  10. Q_OBJECT
  11. public:
  12. explicit QAntPrimaryButton(QWidget* parent = nullptr);
  13. ~QAntPrimaryButton();
  14. QColor normalColor() const;
  15. void setNormalColor(const QColor& color);
  16. QColor hoverColor() const;
  17. void setHoverColor(const QColor& color);
  18. QColor pressedColor() const;
  19. void setPressedColor(const QColor& color);
  20. QColor disabledColor() const;
  21. void setDisabledColor(const QColor& color);
  22. QColor textColor() const;
  23. void setTextColor(const QColor& color);
  24. QColor textDisabledColor() const;
  25. void setTextDisabledColor(const QColor& color);
  26. qreal xRadius() const;
  27. void setXRadius(const qreal& x);
  28. qreal yRadius() const;
  29. void setYRadius(const qreal& y);
  30. qreal borderWidth() const;
  31. void setBorderWidth(qreal& w);
  32. QSize sizeHint();
  33. protected:
  34. void paintNormalState(QPainter &painter) override;
  35. void paintHoverState(QPainter &painter) override;
  36. void paintPressedState(QPainter &painter) override;
  37. void paintDisabledState(QPainter &painter) override;
  38. void paintLoadingState(QPainter &painter) override;
  39. void paintText(QPainter &painter, const QRect &textRect) override;
  40. QColor rippleColor() const override;
  41. private:
  42. QColor m_normalColor;
  43. QColor m_pressedColor;
  44. QColor m_hoverColor;
  45. QColor m_disabledColor;
  46. QColor m_textColor;
  47. QColor m_textDisabledColor;
  48. qreal m_xRadius;
  49. qreal m_yRadius;
  50. qreal m_borderWidth;
  51. };
  52. #endif //QANTPRIMARYBUTTON_H