本文整理汇总了C++中QCheckListItem::setState方法的典型用法代码示例。如果您正苦于以下问题:C++ QCheckListItem::setState方法的具体用法?C++ QCheckListItem::setState怎么用?C++ QCheckListItem::setState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCheckListItem
的用法示例。
在下文中一共展示了QCheckListItem::setState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateBuddyListView
void EvaQunMemberPicker::updateBuddyListView()
{
//if(!mQun) return;
lvBuddyList->clear();
QTextCodec *codec = QTextCodec::codecForName("GB18030");
std::list<std::string> names = EvaMain::user->getGroupNames();
std::list<std::string>::iterator groupIter;
int i=0;
for(groupIter = names.begin(); groupIter!= names.end(); ++groupIter){
QString g = codec->toUnicode(groupIter->c_str());
QCheckListItem *item = new QCheckListItem(lvBuddyList, g, QCheckListItem::CheckBox);
item->setState(QCheckListItem::Off);
groups[i++] = item;
}
//QunInfo info = mQun->getDetails();
std::map<unsigned int, QQFriend>::iterator iter;
std::map<unsigned int, QQFriend> list = (EvaMain::user->getFriendList()).getAllFriendsMap();
for(iter = list.begin(); iter != list.end(); ++iter){
int id = iter->second.getQQ();
QString nick = EvaTextFilter::filter(codec->toUnicode(iter->second.getNick().c_str()));
int groupIndex = iter->second.getGroupIndex();
QCheckListItem *group = groups[groupIndex];
if(!group) continue;
short faceID = (iter->second.getFace())/3 + 1;
if(faceID<1) faceID = 1;
QCheckListItem *item = new QCheckListItem(group, nick + "(" + QString::number(id) + ")", QCheckListItem::CheckBox);
QPixmap *pic = EvaMain::images->getFace(faceID, true);
if(pic) {
QImage img(pic->convertToImage().smoothScale(16, 16));
item->setPixmap(0, QPixmap(img));
}else{
fprintf(stderr, "EvaQunMemberPicker::updateBuddyListView (id:%d, faceID:%d, %s) -- NULL QPixmap pointer, ignored!\n", id, faceID, nick.ascii());
}
if(mQun && mQun->hasMember(id))
item->setState(QCheckListItem::On);
else
item->setState(QCheckListItem::Off);
buddyList[id] = item;
}
}