这样啊,好像是要用setMask的,重新实现paintevent去绘图,然后在resizeevent中把图像的mask设置到控件上,如果控件大小不变的话不用resizeevent在外面设置mask也成
像这样设置mask
先读取图像到image
image = image.scaled(button->width(), button->height());
button->setMask(image.createMaskFromColor(QColor(0,0,0,0), Qt::MaskInColor));
这是图像拉伸的写法,图像要平铺的话自己写吧
先用之前的qss试试,我记得只要图有透明色用qss直接就有效果的