Нема описа

ClickableLabel.h 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef CLICKABLELABEL_H
  2. #define CLICKABLELABEL_H
  3. #include <QLabel>
  4. #include <QMouseEvent>
  5. #include <QDebug>
  6. /// A class that permits a label to be clicked.
  7. ///
  8. /// With this class we can determine de mouse position when is pressed
  9. /// and when the mouse left the label.
  10. ///
  11. class ClickableLabel : public QLabel{
  12. Q_OBJECT
  13. public:
  14. /// \fn ClickableLabel::ClickableLabel(QWidget *parent)
  15. /// \~English
  16. /// \brief Constructor
  17. /// \~Spanish
  18. /// \brief Constructor
  19. explicit ClickableLabel(QWidget *parent = 0);
  20. /// \fn void ClickableLabel::mouseMoveEvent(QMouseEvent *ev)
  21. /// \~English
  22. /// \brief Funtion to add mouse event to the labelWidget
  23. /// \~Spanish
  24. /// \brief Funcion para anadir evento del raton (mouse) al labelWidget
  25. void mouseMoveEvent(QMouseEvent *ev);
  26. /// \fn void ClickableLabel::mousePressEvent(QMouseEvent *ev)
  27. /// \~English
  28. /// \brief Funtion to add mouse event to the labelWidget
  29. /// \~Spanish
  30. /// \brief Funcion para anadir evento del raton (mouse) al labelWidget
  31. void mousePressEvent(QMouseEvent *ev);
  32. /// \fn void ClickableLabel::leaveEvent(QEvent *)
  33. /// \~English
  34. /// \brief Funtion to add mouse event to the labelWidget
  35. /// \~Spanish
  36. /// \brief Funcion para anadir evento del raton (mouse) al labelWidget
  37. void leaveEvent(QEvent *);
  38. int x,y;
  39. signals:
  40. void Mouse_Pressed();
  41. void Mouse_Pos();
  42. void Mouse_Left();
  43. };
  44. #endif // CLICKABLELABEL_H