问题
Some time ago I posted this question trying to understand how could I change the size of a QScrollBar. I was able, at the end, to do what I wanted with the stylesheet code:
setStyleSheet("QScrollBar:vertical { width: 30px; };");
The problem is that, although the width of the scroll bar do change with the code above, the height of the up and down arrow widgets continues to be the same; they don't adjust automatically with the increase in width. So what I get now are two very flat up and down buttons in a large scroll bar.
Unfortunately I wasn't able to even "grasp" the arrow widgets, nor I know what would be the stylesheet code to control just them. The closest I got was from this SO question, but they don't apply to the vertical scroll bar.
So my question is: how can I change the size (particularly the height) of a (vertical) QScrollBar's arrow buttons? (note: no the arrow itself, but the normally square button that contains it)
回答1:
The Desktop theme specifies the height of these buttons. To have them scaling proportionally you have to remove the styling by setting a background color:
QScrollBar:vertical {
width: 30px;
background: red;
}
来源:https://stackoverflow.com/questions/29258487/how-to-change-the-size-of-a-qscrollbars-arrows