qt - QComboBox 样式表在 Ubuntu 16.04 LTS 上不起作用
问题描述
我使用 qss 文件将主题应用于我的应用程序。它是跨平台的。在 Windows 上,我可以按预期看到我想要的样式表。一旦我在 Ubuntu 16.04 LTS(带有肉桂桌面)上运行应用程序,我发现一切都很好,除了组合框。Combo Box 的弹出窗口看起来像原生 ubuntu 下拉菜单。它没有像我预期的那样显示。如何修复它
QComboBox
{
background-color:rgba(0,0,0,0);
border:1px solid rgba(255,255,255,30);
border-radius:5px;
padding-left:5px;
padding-right:5px;
min-height:40px;
}
QComboBox::drop-down
{
subcontrol-origin: padding;
subcontrol-position: top right;
border:0px;
background-color:rgba(0,0,0,0);
width:25;
border-top-right-radius:4px;
border-bottom-right-radius:4px;
}
QComboBox QAbstractItemView
{
background-color:#424B54;
border:0px;
border-radius:0px;
outline: none;
margin:0px;
padding:5px;
}
QComboBox QAbstractItemView::item
{
min-height:40px;
color:rgba(255,255,255, 200);
background-color: rgba(0, 0, 0, 100);
}
QComboBox QAbstractItemView::item:hover,QComboBox QAbstractItemView::item:selected,QComboBox QAbstractItemView::item:selected:hover
{
min-height:40px;
background-color: rgba(255,255,255, 120);
color: rgba(0,0,0);
}
/*QComboBox:on
{
background-color:rgba(146, 39, 142, 255);
}*/
QComboBox::down-arrow
{
border-image: url(:/Theme/theme/dark/general/down.png);
padding:5px;
}
QComboBox::down-arrow:on
{
top: 1px;
left: 1px;
}
注意 我观察到 QScrollBar 也采用原生样式表
解决方案
推荐阅读
- javascript - 如何在 JavaScript 中将导入的函数调用到另一个函数中?
- python - 如何对一行中的值求和?
- python - Dlib 的 simple_object_detector() 运行缓慢
- python - 指定 pandas to_datetime 函数的时区
- python - 使用 XPath 解析 XML (Collada/Dae) 文件
- php - 仅当用户发表了自己的评论时才显示 Wordpress 评论
- kotlin - 实现接口并将参数更改为特定的对象类型
- c# - 电报机器人。如何在发送特定消息后记录用户的响应
- android - Bubblewrap CLI 错误:无法找到或加载主类 com.android.sdklib.tool.sdkmanager.SdkManagerCli
- javascript - 创建没有声明的类