简体   繁体   中英

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

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)

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;
}

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM