如何更改Qcombobox向下箭头图像?
现在我正在使用这个 QSS 代码,但这不起作用,我无法删除向下箭头边框。
QComboBox
{
border: 0px;
}
QComboBox::down-arrow
{
border: 0px;
background-repeat: no-repeat;
background-position: center center;
background-image-width: 50px;
border-image: url(./select-BG.png);
heidth:50px;
width:100px;
}
这是屏幕截图:
这是一个很晚的答案,但我认为我在 Qt 论坛的某个地方找到了解决方案。
当将边框设置为 0px 时,组合框箭头的整个样式似乎被替换。所以我用QComboBox::drop-down
将边框设置为 0x,然后使用QComboBox::down-arrow
定义自定义箭头。下面的代码显示了对一个奇怪的错误的额外修复,该错误无法更改color
文本的属性正确。
QComboBox {
color: black;
font: 14px;
padding: 1px 0px 1px 3px; /* This (useless) line resolves a bug with the font color */
}
QComboBox:focus {
color: red;
}
QComboBox::drop-down
{
border: 0px; /* This seems to replace the whole arrow of the combo box */
}
/* Define a new custom arrow icon for the combo box */
QComboBox::down-arrow {
image: url(Resources/DropDownArrow.png);
width: 14px;
height: 14px;
}
我希望有人可以使用此信息并使其发挥作用:-)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)