QComboBox 添加图片(自带addItem函数就有这个功能,从没有注意过)
方法:
使用 QComboxBox::addItem(QIcon, QString);
示例:
点击(此处)折叠或打开
- QComboBox *combo_status = new QComboBox(this);
- QIcon onlineIcon (":/icon/online.png");
- QIcon leaveIcon (":/icon/leave.png");
- QIcon rejectIcon (":/icon/reject.png");
- QIcon hideIcon (":/icon/hide.png");
- QIcon offlineIcon(":/icon/offline.png");
- combo_status->addItem(onlineIcon,"在线");
- combo_status->addItem(leaveIcon,"离开");
- combo_status->addItem(rejectIcon,"勿扰");
- combo_status->addItem(hideIcon,"隐身");
- combo_status->addItem(offlineIcon,"离线");
http://blog.csdn.net/jan5_reyn/article/details/38955703