标签:des style blog color io os ar sp div
函数原型:BOOL ClipCursor(CONST RECT * lpRect);
参数:IpRect:指向RECT结构的指针,该结构包含限制矩形区域左上角和右下角的屏幕坐标,如果该指针为NULL(空),则鼠标可以在屏幕的任何区域移动。
void TitleBar::mouseMoveEvent(QMouseEvent *event) { if ((event->buttons() & Qt::LeftButton) && this->moveable && this->isMoveable) { RECT rect; QRect qRect = QApplication::desktop()->availableGeometry(); rect.left = qRect.left(); rect.top = qRect.top(); rect.right = qRect.right(); rect.bottom = qRect.bottom(); ClipCursor(&rect); parentWidget()->move(event->globalPos() - this->dragPosition); event->accept(); } } void TitleBar::mouseReleaseEvent(QMouseEvent *event) { if (this->moveable) this->moveable = false; ClipCursor(NULL); }
标签:des style blog color io os ar sp div
原文地址:http://www.cnblogs.com/zw-h/p/4033187.html