我想添加一个背景图像到一个Qt小工具。我在64位Linux上使用Qt Creator 4.0.2。问题是,当我选择一个背景图片时,当我运行程序时,它不会显示(尽管可以在页面上的PushButtons周围看到图像的一部分)。然而,在选择背景颜色时,效果会很完美。(使用CSS)
以下是屏幕:With background-image With background-color
发布于 2016-09-17 01:07:33
尝试通过样式表设置它:
yourWidget->setStyleSheet("background-image: url(<path-to-image>/image.png)")这对我很管用。
https://stackoverflow.com/questions/39536694
复制相似问题