Brak opisu

ClickableLabel.cpp 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include "ClickableLabel.h"
  2. /// \fn ClickableLabel::ClickableLabel(QWidget *parent)
  3. /// \~English
  4. /// \brief Constructor
  5. /// \~Spanish
  6. /// \brief Constructor
  7. ClickableLabel::ClickableLabel(QWidget *parent) : QLabel(parent) {
  8. this->x = 0;
  9. this->y = 0;
  10. }
  11. /// \fn void ClickableLabel::mouseMoveEvent(QMouseEvent *ev)
  12. /// \~English
  13. /// \brief Funtion to add mouse event to the labelWidget
  14. /// \~Spanish
  15. /// \brief Funcion para anadir evento del raton (mouse) al labelWidget
  16. void ClickableLabel::mouseMoveEvent(QMouseEvent *ev){
  17. emit Mouse_Pos();
  18. this->x = ev->x();
  19. this->y = ev->y();
  20. }
  21. /// \fn void ClickableLabel::mousePressEvent(QMouseEvent *ev)
  22. /// \~English
  23. /// \brief Funtion to add mouse event to the labelWidget
  24. /// \~Spanish
  25. /// \brief Funcion para anadir evento del raton (mouse) al labelWidget
  26. void ClickableLabel::mousePressEvent(QMouseEvent *ev){
  27. x = ev->x();
  28. y = ev->y();
  29. emit Mouse_Pressed();
  30. }
  31. /// \fn void ClickableLabel::leaveEvent(QEvent *)
  32. /// \~English
  33. /// \brief Funtion to add mouse event to the labelWidget
  34. /// \~Spanish
  35. /// \brief Funcion para anadir evento del raton (mouse) al labelWidget
  36. void ClickableLabel::leaveEvent(QEvent *){
  37. emit Mouse_Left();
  38. }