#include "mywinheader.h"

MyWinHeader::MyWinHeader(QWidget*)
{
}
void MyWinHeader::mousePressEvent(QMouseEvent *event) {
    winX = this->parentWidget()->window()->x(); winY = this->parentWidget()->window()->y();
    mouseX = event->globalX(); mouseY = event->globalY();
    isMousePressed = true;;
}
void MyWinHeader::mouseReleaseEvent(QMouseEvent*) {
    isMousePressed = false;
}
void MyWinHeader::mouseMoveEvent(QMouseEvent *event) {
    if(!isMousePressed) return;
    this->parentWidget()->window()->move(winX + event->globalX()-mouseX, winY + event->globalY()-mouseY);
}
