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);
{
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);
}