qt/Black_okospace_levelcreator/customlabel.cpp

33 lines
695 B
C++
Raw Permalink Normal View History

2013-11-04 18:06:35 +00:00
#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());
}
}