protected:
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void IcCardDialog::mousePressEvent(QMouseEvent *event)
{
if( (event->button() == Qt::LeftButton) ){
mouse_press = true;
mousePoint = event->globalPos() - this->pos();
// event->accept();
}
}
void IcCardDialog::mouseMoveEvent(QMouseEvent *event)
{
// if(event->buttons() == Qt::LeftButton){ //如果这里写这行代码,拖动会有点问题
if(mouse_press && (mousePoint!=QPoint())){
move(event->globalPos() - mousePoint);
// event->accept();
}
}
void IcCardDialog::mouseReleaseEvent(QMouseEvent *event)
{
mouse_press = false;
mousePoint = QPoint();
}