QListWidget 文本padding設置
QListWidget::item {
/* Won't work without borders set */
border: 0px;
padding-left: 10px;
}
/* For text only */
QListWidget::text {
left: 10px;
}
QComboBox設置
https://blog.csdn.net/p942005405/article/details/104669765
/* 下拉后,整個下拉窗體樣式 */
QComboBox QAbstractItemView {
outline: 0px solid gray; /* 選定項的虛框 */
border: 1px solid yellow; /* 整個下拉窗體的邊框 */
color: green;
background-color: red; /* 整個下拉窗體的背景色 */
selection-background-color: lightgreen; /* 整個下拉窗體被選中項的背景色 */
}
/* 下拉后,整個下拉窗體每項的樣式 */
QComboBox QAbstractItemView::item {
height: 50px; /* 項的高度(設置pComboBox->setView(new QListView());后,該項才起作用) */
}
/* 下拉后,整個下拉窗體越過每項的樣式 */
QComboBox QAbstractItemView::item:hover {
color: #FFFFFF;
background-color: lightgreen; /* 整個下拉窗體越過每項的背景色 */