我在Qt中设计了一个QComboBox。这是图中所示的四舍五入。问题是在圆形边框后面显示一个奇怪的方框。
有人可以告诉我这个盒子是什么以及如何使它不可见吗?
顺便说一句,我也想把阴影带走。
这是我目前的代码:
QComboBox {
border: 1px solid gray;
border-radius: 10px;
min-width: 6em;
}
QComboBox:on {
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
}
QComboBox QAbstractItemView {
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
background: white;
border: 1px solid gray;
box-shadow: transparent;
}
QComboBox::drop-down {
border-color: transparent;
}
有人可以帮忙吗?谢谢!
答案 0 :(得分:0)
你可以像这样添加代码,
(your qcombobox)->view()->window()->setWindowFlags(Qt::Popup | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint);
我试过,它有效
答案 1 :(得分:0)
我认为它将为您提供帮助
QComboBox QAbstractItemView {
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
background: white;
border: 1px solid gray;
box-shadow: transparent;
padding: 4px 4px 4px 4px
}
答案 2 :(得分:-2)
也许你可以提供一些html,这会让它变得更容易。
尝试:
QComboBox{overflow:hidden}