在窗口w上面画个黄色的框:在窗口上添加一个label,然后在label上画框

 QLabel label(&w);
label.setScaledContents(true);
QPixmap pix(w.size());
pix.fill(Qt::transparent);
QPainter p(&pix);
p.setRenderHint(QPainter::Antialiasing);
p.setPen(QPen(Qt::yellow,));
p.drawRect(w.rect().adjusted(,,-,-));
label.setPixmap(pix);
05-08 15:44