当前位置: 代码迷 >> QT开发 >> QComboBox下拉框的Qss设立
  详细解决方案

QComboBox下拉框的Qss设立

热度:32   发布时间:2016-04-25 03:50:24.0
QComboBox下拉框的Qss设置
如题,如何设置QComboBox下拉框的背景颜色和文字颜色?


------解决方案--------------------

------解决方案--------------------
要在cpp里面加:

#include <QStyledItemDelegate>

QStyledItemDelegate* itemDelegate = new QStyledItemDelegate();
ui->comboBox->setItemDelegate(itemDelegate);


QSS部分:

QComboBox QAbstractItemView{
    xxxx
}


具体的可以去看QAbstractItemView的stylesheet