QComboBox stylesheet problem
-
I have done a lot of googling and trial and error to get this combobox to where it is. The problem is when I modify the border of the dropdown, if the border is a different color than the background it looks like the scroll bar is being drawn on top of the border. I currently have the up and down buttons hidden, but even if I enable them and move them around there is still this problem. The only time it goes away is if I don't override the border of the dropdown. See attached image and stylesheet:
@QAbstractItemView {
border: 2px solid #2ef928;
padding: 5 5 5 5;
border-radius: 5px;
background: black;
color: #2ef928;
font-size: 30px;
}/* Sets up scrollbar size, border, color /
QScrollBar:vertical {
/ border: 2px solid red; /
border-radius: 5px;
background: black;
width: 48px;
/ margin sets up how far the handle can travel*/
margin: 0px 0px 0px 0px;
}/* Sets up the color and height of handle */
QScrollBar::handle:vertical {
border-radius: 5px;
background: #2ef928;
min-height: 48px;
}/* This remvoes the bottom button by setting the height to 0px */
QScrollBar::add-line:vertical {
height: 0px;
subcontrol-position: bottom;
subcontrol-origin: margin;
}/* This remvoes the top button by setting the height to 0px */
QScrollBar::sub-line:vertical {
height: 0px;
subcontrol-position: top;
subcontrol-origin: margin;
}/*
QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {
border: 2px solid grey;
width: 5px;
height: 5px;
background: white;
}
*//* need this to get rid of crosshatching on scrollbar background */
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
background: none;
}QComboBox {
border: 2px solid #2ef928;
border-radius: 20px;
background: black;
padding-left: 5px;
color: #2ef928;
font-size: 30px;
height: 50px;
width: 309px;
}QComboBox::down-arrow {
image: url();
}QComboBox::drop-down {
border: 0px;
}@
-
Update:
I found that if I adjusted the padding along the bottom to 16px, whatever is on top of the border is out of the way. When I did this, it brought to my attention that there is some sort of transparent control at the bottom that if I move my mouse over it scrolls down the list. This is only there when I change the border.
@QAbstractItemView {
border: 2px solid #2ef928;
padding: 5 5 16 5;
border-radius: 10px;
background: black;
color: #2ef928;
font-size: 30px;
}/* Sets up scrollbar size, border, color /
QScrollBar:vertical {
border-radius: 10px;
background: black;
width: 48px;
/ margin sets up how far the handle can travel*/
margin: 0px 0px 0px 0px;
}/* Sets up the color and height of handle */
QScrollBar::handle:vertical {
border-radius: 10px;
background: #2ef928;
min-height: 48px;
}/* This remvoes the bottom button by setting the height to 0px */
QScrollBar::add-line:vertical {
height: 0px;
subcontrol-position: bottom;
subcontrol-origin: margin;
}/* This remvoes the top button by setting the height to 0px */
QScrollBar::sub-line:vertical {
height: 0px;
subcontrol-position: top;
subcontrol-origin: margin;
}/* need this to get rid of crosshatching on scrollbar background */
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
background: none;
}QComboBox {
border: 2px solid #2ef928;
border-radius: 20px;
background: black;
padding-left: 5px;
color: #2ef928;
font-size: 30px;
height: 50px;
width: 309px;
}QComboBox::down-arrow {
image: url();
}QComboBox::drop-down {
border: 0px;
}@