我尝试了许多不同的选项来设置 QCombobox 的样式,但我在 mac osx 上仍然遇到一些问题。 看起来像这样:look on osx http://img90.imageshack.us/img90/9550/stylesheets.png
我想删除 View 列表的白色顶部/底部,但我似乎找不到执行此操作的方法。
这是我现在的代码:
QComboBox{
color:rgba(200,200,200,255);
background-color:rgba(71,71,71,255);
selection-color:rgba(243,149,0,255);
selection-background-color:rgba(71,71,71,255);
}
QComboBox QAbstractItemView{
border-radius:0px;
border:0px;
selection-background-color:rgba(71,71,71,255);
background:rgba(71,71,71,255);
color:rgb(200,200,200);
}
感谢任何帮助
谢谢
最佳答案
使用自己的应用程序样式(基于 QProxyStyle)并重写 QProxyStyle::styleHint 为:
int CMyProxyStyle::styleHint( StyleHint hint, const QStyleOption* option = 0, const QWidget* widget = 0, QStyleHintReturn* returnData = 0 ) const { if( SH_ComboBox_Popup == hint ) return 0;//disable combo-box popup top & bottom areas return QProxyStyle::styleHint( hint, option, widget, returnData ); }
将自己的样式安装到 qApp 实例:
qApp->setStyle( new CMyProxyStyle );
关于c++ - macOS 上的 Qt 组合框样式表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16261568/