Qt 设置样式表 加载图片时
//背景 不会自动适应图片,background-image像电脑桌面的平铺,图片尺寸不变setStyleSheet(QString("background-image:url(:/image/test.jpg)"));//背景 自动适应图片,border-image像桌面的拉伸效果,常用setStyleSheet(QString("border-image:url(:/image/test.jpg);"));//前景 自动适应图片,border-image像桌面的拉伸效果,常用setStyleSheet(QString("image:url(:/image/test.jpg);"));QCustomplot背景自适应 拉伸
ui->customPlot->setBackground(QPixmap(":/image/error.png"),true,Qt::KeepAspectRatioByExpanding);
QCustomplot背景默认不拉伸
v ui->customPlot->setBackground(QPixmap(":/image/error.png"));
如果觉得《image border-image background-image的区别》对你有帮助,请点赞、收藏,并留下你的观点哦!