How to change the size of a QScrollBar's arrows?

丶灬走出姿态 提交于 2020-01-16 06:08:24

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!