QT中显示框去标题栏后重载鼠标移动函数

xiaoxiao2021-02-28  23

protected:    void mousePressEvent(QMouseEvent *event);  void mouseReleaseEvent(QMouseEvent *event);  void mouseMoveEvent(QMouseEvent *event);      void state_info::mousePressEvent(QMouseEvent *event) {     pressflag = true;     starPos = event->pos();     QWidget::mousePressEvent(event); } void state_info::mouseReleaseEvent(QMouseEvent *event) {     pressflag = false;     QWidget::mouseReleaseEvent(event); } void state_info::mouseMoveEvent(QMouseEvent *event) {     if(pressflag)     {         QPoint relaPos(QCursor::pos() - starPos);         move(relaPos);     }     QWidget::mouseMoveEvent(event); }
转载请注明原文地址: https://www.6miu.com/read-1950282.html

最新回复(0)