您的位置:首页 > 其它

OBS源码阅读笔记--无边框

2016-11-02 11:53 411 查看
void OBSBasic::mousePressEvent(QMouseEvent * event)

{
this->windowPos = this->pos();
this->mousePos = event->globalPos();
this->dPos = mousePos - windowPos;

}

void OBSBasic::mouseMoveEvent(QMouseEvent* event)

{
this->move(event->globalPos() - this->dPos);

}

void OBSBasic::slottimedone()

{
QSize wndSize;
wndSize.setWidth(this->width() + 1);
wndSize.setHeight(this->height() + 1);
this->resize(wndSize);
}

QTimer::singleShot(1500, this, SLOT(slottimedone()));//时间要大于1500

void OBSBasic::resizeEvent(QResizeEvent * event)

{
QPainterPath path;//jiang
QRectF rect = QRectF(0, 0, this->width(), this->height());
path.addRoundedRect(rect, 5, 5);
QPolygon polygon = path.toFillPolygon().toPolygon();//获得这个路径上的所有的点
QRegion region(polygon);//根据这些点构造这个区域
setMask(region);

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: