关于QComboBox的基本应用、代理设置已经讲过,也足以应对QComboBox的应用,使用QComboBox,往往需要可编辑(combo_box->setEditable(true)),当然美化环节必不可少,细心的人也许会发现一些问题!今天在这里再次吐槽,关于QComboBox你不知道的那些事!
QComboBox{
border-radius:2px;
border:1px solid gray;
}
QComboBox:hover{
border-radius: 3px;
border-width:2px;
border-color:rgb(50, 180, 250);
}
QComboBox::down-arrow{
image:url(:/login/arrow_down);
}
QComboBox::drop-down{
width:20px;
border-left:1px solid gray;
background:transparent;
}
QComboBox::drop-down:hover{
border-left:1px solid lightgray;
background:rgb(220, 240, 250);
}
normal:
hover:
normal:
hover:
QComboBox:hover{
border-radius: 3px;
border-width:2px;
border-color:rgb(50, 180, 250);
}
combo_box->lineEdit()->setStyleSheet("border:1px solid red;");
QComboBox{
}
注:
本文深入分析了QComboBox在设置可编辑模式后,边框宽度变化及样式影响的原因,并提供了通过padding解决视觉不一致问题的方法,同时强调了QComboBox内部组件与QLineEdit之间的关系。



3713

被折叠的 条评论
为什么被折叠?



