sch*_*eda 5 c++ macos qt qtstylesheets
我在 Mac OSX 中设置 Qt5 组合框弹出窗口的样式时遇到一些问题
我的 QComboBox 样式表
QComboBox {
font-size: 11px;
height: 16px;
padding: 1px 5px 1px 5px;
border: 2px groove #4B4F4F;
border-bottom: 2px ridge #424545;
border-right: 2px ridge #424545;
border-radius: 3px;
color: #DEDEDE;
background: qlineargradient(x1:0, x2:0, y1:0, y2:1, stop:0 #6B6E6E, stop:1 #595B5B);
}
QComboBox::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 14px;
border-left-width: 1px;
border-left-color: #999999;
border-left-style: solid; /* just a single line */
border-top-right-radius: 3px; /* same radius as the QComboBox */
border-bottom-right-radius: 3px;
}
QComboBox::down-arrow {
height: 8px;
width: 8px;
image: url(:/resources/images/downarrow.png);
}
QComboBox:on {
border: 1px solid #00A7CC;
padding-left: 6px;
}
QComboBox QAbstractItemView {
min-width: 100px;
outline: 1px solid #808A8A;
border: 1px solid #373838;
selection-background-color: #808A8A;
background-color: #4A4C4F;
}
QComboBox:!enabled {
color: #909090;
}
Run Code Online (Sandbox Code Playgroud)
Mac OSX 上的结果如下所示:

我想改变以下几点:
编辑:
我可以用空格解决问题,但不能用勾号解决问题。看起来还是很丑。
我将 QComboBox 的填充更改为:
QComboBox {
padding: 0px 5px 0px 5px;
....
Run Code Online (Sandbox Code Playgroud)
我的左上角仍然有一个小点,不知道如何隐藏它
小智 0
我有同样的问题,但仍然没有找到解决方案,所以我更改了样式工厂:
#if defined(Q_OS_MAC)
ui->cb_action->setStyle(QStyleFactory::create("Windows"));
#endif
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2065 次 |
| 最近记录: |