name_label->setStyleSheet("background-image:url(:/album/album_topbar2);\
font-family: Noto Sans SC;\
font-style: normal;\
font-weight: normal;\
font-size: 30px;\
line-height: 43px;\
color: #FFFFFF;}");
remark_button->setStyleSheet("QPushButton{border-image: url(:/album/album_remark_bg);\
font-family: Noto Sans SC;\
font-style: normal;\
font-weight: normal;\
font-size: 24px;\
line-height: 35px;\
text-align: left bottom;\
padding-left: 20px; \
padding-bottom: 20px;\
color: rgba(255, 255, 255, 0.7);}");
背景应该是两个半透明渐变色块,但实际上此设置未生效。父窗口重写了paintEvent如下:
void ShowWidget::paintEvent(QPaintEvent *)
{
QPainter painter(this);
QImage * image = currentImage;
const qreal iw = image->width();
const qreal ih = image->height();
const qreal wh = height();
const qreal ww = width();
painter.translate(ww/2, wh/2);
painter.translate(-iw/2, -ih/2);
painter.drawImage(0,0,*image);
}
实际结果:
预期结果: