So I have a QComboBox and I want to add some padding between the top bar and the items. Here is the code:
from PyQt6.QtWidgets import QComboBox
class DropDown(QComboBox):
def __init__(self , parent):
super().__init__(parent)
items = ["Science" , "Arts" , "Computer"]
self.setStyleSheet("""
QComboBox{
background-color: #4C566A;
outline: none;
border: none;
height: 50px;
border-radius: 10px;
color: #D8DEE9;
font-family: Comfortaa;
padding-left: 20px
}
QComboBox::down-arrow{
image: url(frontend/assets/svgs/downarrow.svg)
}
QComboBox::drop-down{
subcontrol-origin: padding;
subcontrol-position: top right;
width: 30px;
padding-right: 10px;
border-left-width: 1px;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
QComboBox QAbstractItemView {
background-color: #4C566A;
}
""")
self.addItems(items)
But it seems like I didn't get one :(
Things I have tried:
- Add padding-top to
QComboBox QAbstractItemView
- Add padding-top to
QComboBox QAbstractItemView
and setting the background-color to transparent. - Add margin-top