我正在嘗試設定 QtComboxBox 和 ListView 的樣式,但我不確定當組合框的專案懸停時如何洗掉這個煩人的邊框。這就是我所擁有的
QListView:
/*-----QListView-----*/
QListView
{
background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:1, stop:0 rgba(50, 61, 80, 255),stop:1 rgba(44, 49, 69, 255));
color: #fff;
font-size: 12px;
font-weight: bold;
border: 1px solid #191919;
border-radius: 10px;
show-decoration-selected: 0;
}
QListView::item
{
color: #green;
background-color: #454e5e;
padding: 5px;
border: 10px solid #191919;
border-radius: 10px;
padding-left : 10px;
height: 42px;
}
QListView::item:selected
{
color: #31cecb;
background-color: #454e5e;
border: 2px solid magenta;
border-radius: 10px;
}
QListView::item:!selected
{
color:white;
background-color: transparent;
border: none;
padding-left : 10px;
}
QListView::item:!selected:hover
{
color: #bbbcba;
background-color: #454e5e;
border: transparent;
padding-left : 10px;
border-radius: 10px;
}
QComboBox:
/*-----QComboBox-----*/
QComboBox
{
color: #fff;
font-size: 13px;
font-weight: bold;
border: 1px solid blue;
border-radius: 5px;
padding: 5px;
}
QComboBox::drop-down
{
width: 35px;
border: 1px solid blue;
border-radius: 5px;
padding: 5px;
}
這給了我類似的東西

我想要做的是洗掉專案標簽周圍的灰色矩形選擇,我該怎么做?
uj5u.com熱心網友回復:
添加border-style:none;您不想看到邊框的位置。
例如 :
QComboBox#comboBoxName{
border-style:none;
}
我也在你的代碼中嘗試這個,這是它的結果:
QComboBox::item {
width: 35px;
height:35px;
border-style:none;
}

轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/520138.html
上一篇:如何圓化視頻元素的邊框?
