qt中的样式表真是个神奇的东西,哈哈哈,话不多说,直接上代码和结果。
setStyleSheet("QSpinBox::up-button{border-image:url(:/up.PNG);"
"subcontrol-position:right;width:40px;height:40px;}"
"QSpinBox::down-button{border-image:url(:/down.PNG);"
"subcontrol-position:left;width:40px;height:40px;}"
"QSpinBox:up-button:pressed{margin-top:4px;}"
"QSpinBox:down-button:pressed{margin-top:4px;}"
"QSpinBox{background-color:yellow;}");
结果:通过点击加号减号来控制值的变化,比默认的好看很多有木有!!!