1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| virtual voidmousePressEvent(QMouseEvent* e);
virtual voidmouseMoveEvent(QMouseEvent* e);
virtualvoid mouseReleaseEvent(QMouseEvent* e);
bool m_bIsWindowMoveable;
voidClassName::mousePressEvent(QMouseEvent* e) { if(e->button() == Qt::LeftButton) { m_bIsWindowMoveable = true; } }
void ClassName:mouseMoveEvent(QMouseEvent*e) { if(m_ bIsWindowMoveable) { move(e->globalPos()); } }
voidClassName::mouseReleaseEvent(QMouseEvent* e) { m_bIsWindowMoveable = false; }
|