我需要 QListWidget 中的滚动条
margin = 6;
你应该使用样式表,例如看看这个:
QScrollBar:horizontal {
background: transparent;
height: 10px;
margin: 0;
}
QScrollBar:vertical {
background: transparent;
width: 10px;
margin: 0;
}
QScrollBar::handle:horizontal {
background: #374146;
min-width: 16px;
border-radius: 5px;
}
QScrollBar::handle:vertical {
background: #374146;
min-height: 16px;
border-radius: 5px;
}
QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal,
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
background: none;
}
QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal,
QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {
border: none;
background: none;
}
QListWidget QScrollBar::handle:horizontal {
background-color:rgb(0, 170, 171);
}
QListWidget QScrollBar::handle:vertical {
background-color:rgb(0, 170, 171);
margin:2;
}
输出
我设置边距 2,边距 6 看起来像这样