Qt 一张图片显示在其他组件之上

图片放在QLabel上,注意设置QLable一些属性

QImage img("test.png");
img = img.scaledToWidth(400,Qt::SmoothTransformation);
QLabel* label = new QLabel(this, Qt::FramelessWindowHint|Qt::Tool);
label->setPixmap(QPixmal::fromImage(img));
label->setGeomtry(0,0,400,300);
label->setAttribute(Qt::WA_TranslucentBackground);
label->show();

 

posted @ 2019-10-22 14:21  酷熊  阅读(654)  评论(0编辑  收藏  举报