标签:代码 erp code height end width asi bsp span
在paintEvent事件中绘制窗口边框
这里我们需要重写paintEvent方法,具体代码如下:
void paintEvent(QPaintEvent *event) { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing); // 反锯齿; painter.setBrush(QBrush(Qt::red)); painter.setPen(Qt::transparent); QRect rect = this->rect(); rect.setWidth(rect.width() - 1); rect.setHeight(rect.height() - 1); painter.drawRoundedRect(rect, 15, 15); //也可用QPainterPath 绘制代替 painter.drawRoundedRect(rect, 15, 15); { QPainterPath painterPath; painterPath.addRoundedRect(rect, 15, 15); p.drawPath(painterPath); } QWidget::paintEvent(event); }
标签:代码 erp code height end width asi bsp span
原文地址:https://www.cnblogs.com/xushenghai19841013/p/14720083.html