PDA

View Full Version : QComboBox with transparent dropdown



MichaH
17th August 2016, 10:53
Hi everyone,

I'm working with a couple of QComboBoxes which are needed for e.g. changings in language and units. The stylesheet of each one looks as follows:


QComboBox {
background: qlineargradient(
x1:0, y1:0, x2:0, y2:1,
stop:0 #f9f9f9,
stop: 0.5 #c6c6c6,
stop: 0.6 #dfdfdf,
stop:1 #f9f9f9 );
border-style: solid;
border-width: 1px;
border-color: rgb(0, 93, 168);
border-radius: 30px;
color: rgb(0, 93, 168);
min-width: 170px;
min-height: 60px;
padding-left: 15px;
}
QComboBox:on {
border-radius: 30px;
background:transparent;
}
QComboBox::drop-down {
image: url(:/bwt/downarrow.png);
subcontrol-position: center right;
margin-right: 10px;
}
QComboBox QAbstractItemView::item {
padding: 10px 10px 10px 10px;
}
QComboBox QAbstractItemView {
color: rgb(0, 93, 168);
background: transparent;
}
QComboBox QListView::item {
background: qradialgradient(
cx: 0.5, cy: -1.6, fx: 0.5, fy: 0,
radius: 2,
stop: 0 #C4C4C4,
stop: 1 #DBDBDB );
border-style: solid;
border-width: 1px;
border-color: rgb(0, 93, 168);
border-radius: 20px;
}


Since I'm not able to upload pictures directly to this post here's an external link to what I get using the stylesheet from above:
https://postimg.org/image/55c1hrj73/

As you can see there's still a box with a white background behind the dropdown menu which I'd like to get rid of. Is it possible to keep the rounded edges while the white box behind it disappears using stylesheet? If not how do I solve this issue?

Any help is appreciated!

Thanks,
Micha