QComboBox下拉框的Qss设置

微雨流光 2013-06-04 01:51:22
如题,如何设置QComboBox下拉框的背景颜色和文字颜色?

...全文
1538 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
哆林木子 2014-03-06
  • 打赏
  • 举报
回复
样式表: QComboBox QAbstractItemView::item { color: #162936; font: 75 12pt "微软雅黑"; min-height: 38px; min-width: 60px;} QComboBox { min-height: 38px; min-width: 60px; padding-left:8px; color: #162936; font: 75 12pt "微软雅黑"; } 构造函数添加一行: ui->comboBox->setView(new QListView());
chrisforbt 2013-12-02
  • 打赏
  • 举报
回复 1
QComboBox QAbstractItemView { selection-color:rgb(255, 255, 255); selection-background-color:rgb(0, 0, 0); } 第一个是选中文字色,第二个是背景色
微雨流光 2013-06-04
  • 打赏
  • 举报
回复
不要贴整个的...这个整个的我也有 哪句是下拉框的背景色和文字颜色设置啊 谢谢
ppdayz 2013-06-04
  • 打赏
  • 举报
回复 1
要在cpp里面加:

#include <QStyledItemDelegate>

QStyledItemDelegate* itemDelegate = new QStyledItemDelegate();
ui->comboBox->setItemDelegate(itemDelegate);
QSS部分:

QComboBox QAbstractItemView{
    xxxx
}
具体的可以去看QAbstractItemView的stylesheet
星际空间 2013-06-04
  • 打赏
  • 举报
回复

16,203

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧