【发布时间】:2014-07-12 07:57:40
【问题描述】:
我已经尝试在网上到处查找它,到目前为止还没有定论。我制作了三个 png 文件,其中两个用于悬停和按下状态。我尝试使用以下代码编辑常规按钮的样式表,但没有任何反应
QPushButton#myPushButton
{
background-color: transparent;
background-image: url(":C:\Users\imagepath");
background-repeat: none; rgb(255, 255, 255)
border: none;
}
QPushButton#myPushButton:hover
{
background-image: url(":C:\Users\imagepath");
}
QPushButton#myPushButton:pressed
{
background-image: url(":C:\Users\imagepath");
}
【问题讨论】:
-
你为什么要用样式表来做这个?
-
搜索“QPushButton Image”显示使用 QPushButton::setIcon() 的第一个链接 stackoverflow.com/questions/3137805/…
-
更好的是,搜索“QPushButton Image Stylesheet”会显示第一个链接:stackoverflow.com/questions/2675925/…
-
查看stackoverflow.com/questions/17874898/… 以了解资源标识符的格式
标签: qt qtstylesheets