void paintEvent(QPaintEvent* event);
QPainter painter(this);
// 反锯齿;
painter.setRenderHint(QPainter::Antialiasing);
// painter.setBrush(QBrush(Qt::red));
// 背景图片
painter.drawPixmap(rect(), QPixmap(background));
// 设置画笔颜色
painter.setPen(QColor(0, 0, 0));
// 设置边框为圆角 (不好看)
QRect rect = this->rect();
rect.setWidth(rect.width() - 1);
rect.setHeight(rect.height() - 1);
painter.drawRoundedRect(rect, 20, 20);
QWidget::paintEvent(event);