static QPoint last(0,0); void Display::mousePressEvent(QMouseEvent *event) { if(event->y()<50) { last = event->globalPos(); qDebug()<<event->y(); } } void Display::mouseMoveEvent(QMouseEvent *event) { if(event->y()<50) { int dx = event->globalX() - last.x(); int dy = event->globalY() - last.y(); last = event->globalPos(); move(x()+dx, y()+dy); } } void Display::mouseReleaseEvent(QMouseEvent *event) { if(event->y()<50) { int dx = event->globalX() - last.x(); int dy = event->globalY() - last.y(); move(x()+dx, y()+dy); } }
static QPoint last(0,0); void Display::mousePressEvent(QMouseEvent *event) { if(event->y()<TITLESIZE) { last = event->globalPos(); } } void Display::mouseMoveEvent(QMouseEvent *event) { if(event->y()<TITLESIZE) { int dx = event->globalX() - last.x(); int dy = event->globalY() - last.y(); last = event->globalPos(); move(x()+dx, y()+dy); } } void Display::mouseReleaseEvent(QMouseEvent *event) { if(event->y()<TITLESIZE) { int dx = event->globalX() - last.x(); int dy = event->globalY() - last.y(); move(x()+dx, y()+dy); } }