33 lines
695 B
C++
33 lines
695 B
C++
|
#include "customlabel.h"
|
||
|
|
||
|
CustomLabel::CustomLabel(QWidget *parent) :
|
||
|
QLabel(parent)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void CustomLabel::mousePressEvent(QMouseEvent *ev)
|
||
|
{
|
||
|
emit buttonPressed(ev->x(), ev->y());
|
||
|
}
|
||
|
|
||
|
void CustomLabel::mouseReleaseEvent(QMouseEvent * ev)
|
||
|
{
|
||
|
|
||
|
if (ev->button() == Qt::LeftButton)
|
||
|
{
|
||
|
emit leftButtonReleased(ev->x(), ev->y());
|
||
|
}
|
||
|
if (ev->button() == Qt::RightButton)
|
||
|
{
|
||
|
emit rightButtonReleased(ev->x(), ev->y());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void CustomLabel::mouseMoveEvent(QMouseEvent *ev)
|
||
|
{
|
||
|
if (ev->buttons() & Qt::RightButton)
|
||
|
{
|
||
|
emit mouseMoveWithRightButtonPressed(ev->x(), ev->y());
|
||
|
}
|
||
|
}
|