0
我知道很多人問這個問題。我也在這裏搜索過它。最簡單的一個解決方案是用樣式表:如何爲選中的QRadioButton製作顏色,但看起來像標準?
QRadioButton {
background-color: rgb(252,254,252);
color: black;
}
QRadioButton::indicator {
width: 11px;
height: 11px;
border-radius: 5px;
}
QRadioButton::indicator::unchecked{
border: 1px solid;
border-color: rgb(132,132,132);
border-radius: 5px;
background-color: white;
width: 11px;
height: 11px;
}
QRadioButton::indicator::checked{
border: 3px solid;
border-color: white;
border-radius: 6px;
background-color: rgb(0,116,188);
width: 7px;
height: 7px;
}
但如果我這樣做的方式,結果是這樣的 (該按鈕只有白色的圓邊和藍圓內)。但是,我們可以將它們之外的黑色邊框像標準選中的單選按鈕 一樣嗎? (黑色邊框 - >白色邊框 - >藍色圓形)。我們可以在Qt中做到嗎?
好了,我沒想到這個解決方案。那太棒了。謝謝你,投票!祝你今天愉快! :) – gnase