本文整理汇总了C++中UserResource::setStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ UserResource::setStatus方法的具体用法?C++ UserResource::setStatus怎么用?C++ UserResource::setStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserResource
的用法示例。
在下文中一共展示了UserResource::setStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: maybeTip
bool GCUserView::maybeTip(const QPoint &pos)
{
Q3ListViewItem *qlvi = itemAt(pos);
if(!qlvi || !qlvi->parent())
return false;
GCUserViewItem *lvi = (GCUserViewItem *) qlvi;
QRect r(itemRect(lvi));
const QString &nick = lvi->text(0);
const Status &s = lvi->s;
UserListItem u;
// SICK SICK SICK SICK
GCMainDlg* dlg = gcDlg_;
if (!dlg) {
qDebug("Calling maybetip on an entity without an owning dialog");
return false;
}
u.setJid(dlg->jid().withResource(nick));
u.setName(nick);
// Find out capabilities info
Jid caps_jid(s.mucItem().jid().isEmpty() ? dlg->jid().withResource(nick) : s.mucItem().jid());
QString client_name = dlg->account()->capsManager()->clientName(caps_jid);
QString client_version = (client_name.isEmpty() ? QString() : dlg->account()->capsManager()->clientVersion(caps_jid));
// make a resource so the contact appears online
UserResource ur;
ur.setName(nick);
ur.setStatus(s);
ur.setClient(client_name,client_version,"");
u.userResourceList().append(ur);
PsiToolTip::showText(mapToGlobal(pos), u.makeTip(), this);
return true;
}
示例2: paintContact
void paintContact(QPainter* mp, const QStyleOptionViewItem& option, const QModelIndex& index, GCUserViewItem* item) const
{
mp->save();
QStyleOptionViewItem o = option;
QPalette palette = o.palette;
MUCItem::Role r = item->s.mucItem().role();
QRect rect = o.rect;
if(nickColoring_) {
if(r == MUCItem::Moderator)
palette.setColor(QPalette::Text, colorModerator_);
else if(r == MUCItem::Participant)
palette.setColor(QPalette::Text, colorParticipant_);
else if(r == MUCItem::Visitor)
palette.setColor(QPalette::Text, colorVisitor_);
else
palette.setColor(QPalette::Text, colorNoRole_);
}
mp->fillRect(rect, (o.state & QStyle::State_Selected) ? palette.color(QPalette::Highlight) : palette.color(QPalette::Base));
if(showAvatar_) {
QPixmap ava = item->avatar();
if(ava.isNull()) {
ava = IconsetFactory::iconPixmap("psi/default_avatar");
}
ava = AvatarFactory::roundedAvatar(ava, avatarRadius_, avatarSize_);
QRect avaRect(rect);
avaRect.setWidth(ava.width());
avaRect.setHeight(ava.height());
if(!avatarAtLeft_) {
avaRect.moveTopRight(rect.topRight());
avaRect.translate(-1, 1);
rect.setRight(avaRect.left() - 1);
}
else {
avaRect.translate(1, 1);
rect.setLeft(avaRect.right() + 1);
}
mp->drawPixmap(avaRect, ava);
}
QPixmap status = showStatusIcons_ ? item->icon() : QPixmap();
int h = rect.height();
int sh = status.isNull() ? 0 : status.height();
rect.setHeight(qMax(sh, fontHeight_));
rect.moveTop(rect.top() + (h - rect.height())/2);
if(!status.isNull()) {
QRect statusRect(rect);
statusRect.setWidth(status.width());
statusRect.setHeight(status.height());
statusRect.translate(1, 1);
mp->drawPixmap(statusRect, status);
rect.setLeft(statusRect.right() + 2);
}
else
rect.setLeft(rect.left() + 2);
mp->setPen(QPen((o.state & QStyle::State_Selected) ? palette.color(QPalette::HighlightedText) : palette.color(QPalette::Text)));
mp->setFont(o.font);
mp->setClipRect(rect);
QTextOption to;
to.setWrapMode(QTextOption::NoWrap);
mp->drawText(rect, index.data(Qt::DisplayRole).toString(), to);
QList<QPixmap> rightPixs;
if(showAffiliations_) {
MUCItem::Affiliation a = item->s.mucItem().affiliation();
QPixmap pix;
if(a == MUCItem::Owner)
pix = IconsetFactory::iconPixmap("affiliation/owner");
else if(a == MUCItem::Admin)
pix = IconsetFactory::iconPixmap("affiliation/admin");
else if(a == MUCItem::Member)
pix = IconsetFactory::iconPixmap("affiliation/member");
else if(a == MUCItem::Outcast)
pix = IconsetFactory::iconPixmap("affiliation/outcast");
else
pix = IconsetFactory::iconPixmap("affiliation/noaffiliation");
if(!pix.isNull())
rightPixs.push_back(pix);
}
if(showClients_) {
GCUserView *gcuv = (GCUserView*)item->treeWidget();
GCMainDlg* dlg = gcuv->mainDlg();
QPixmap clientPix;
if(dlg) {
UserListItem u;
const QString &nick = item->text(0);
Jid caps_jid(/*s.mucItem().jid().isEmpty() ? */ dlg->jid().withResource(nick) /* : s.mucItem().jid()*/);
CapsManager *cm = dlg->account()->client()->capsManager();
QString client_name = cm->clientName(caps_jid);
QString client_version = (client_name.isEmpty() ? QString() : cm->clientVersion(caps_jid));
UserResource ur;
ur.setStatus(item->s);
ur.setClient(client_name,client_version,"");
u.userResourceList().append(ur);
QStringList clients = u.clients();
//.........这里部分代码省略.........