我尝试添加带有图标的QAction,但无法正确放置。所以最终的解决方案既简单又愚蠢,但它有效:
okSpinBoxStylesheet= "QDoubleSpinBox{"
"border: 1px solid grey;"
"border-radius: 8px;"
"margin-right: 20px;"
"background-color: white;"
"font: 12px Manrope;"
"padding: 0px 0px 0px 8px;""}"
alertSpinBoxStyleSheet= "QDoubleSpinBox{"
"border: 1px solid grey;"
"border-radius: 8px;"
"margin-right: 20px;"
"background: url(:/rsc/img/alertBack.png);"
"background-position: right center;"
"font: 12px Manrope;"
"padding: 0px 0px 0px 8px;""}"
当我需要图标时,我只需应用适当的样式表