No Description

bird.h 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef BIRD_H
  2. #define BIRD_H
  3. #include <QWidget>
  4. #include <QPainter>
  5. /// A class to represent birds.
  6. ///
  7. /// Bird is a subclass of QWidget. This means that the following QWidget functions
  8. /// are also available for objects of the class Bird:
  9. /// * move(int x, int y): to move the bird to position (x,y)
  10. /// * x(), y(): get the x position, get the y() position
  11. /// * hide(): to hide a bird that has been painted
  12. class Bird : public QWidget
  13. {
  14. Q_OBJECT
  15. public:
  16. ///
  17. /// Enum type for the EyeBrow
  18. ///
  19. enum EyeBrowType {
  20. UNI, /**< enum value 0 */
  21. ANGRY, /**< enum value 1 */
  22. UPSET, /**< enum value 2 */
  23. BUSHY /**< enum value 3 */
  24. };
  25. explicit Bird(QWidget *parent = 0);
  26. Bird(int , EyeBrowType , QString , QString, QWidget *parent = 0) ;
  27. // getters
  28. QString getEyeColor() const;
  29. QString getFaceColor() const;
  30. int getSize() const;
  31. EyeBrowType getEyebrow() const;
  32. Qt::GlobalColor getColor(QString) const;
  33. // setters
  34. void setEyeColor(QString) ;
  35. void setFaceColor(QString) ;
  36. void setSize(int) ;
  37. void setEyebrow(EyeBrowType) ;
  38. Bird & operator=(Bird &b);
  39. signals:
  40. public slots:
  41. protected:
  42. void paintEvent(QPaintEvent *event);
  43. private:
  44. int size ;
  45. EyeBrowType eyeBrow ;
  46. QString color ;
  47. QString eColor ;
  48. int randInt(int min, int max) ;
  49. };
  50. #endif // BIRD_H