本文整理汇总了C++中QListViewItem::itemPos方法的典型用法代码示例。如果您正苦于以下问题:C++ QListViewItem::itemPos方法的具体用法?C++ QListViewItem::itemPos怎么用?C++ QListViewItem::itemPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListViewItem
的用法示例。
在下文中一共展示了QListViewItem::itemPos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slot_player
//.........这里部分代码省略.........
slot_checkbox(0, b);
// checkbox looking
b = (p->info.contains('!') != 0);
slot_checkbox(1, b);
// checkbox quiet
// NOT CORRECT REPORTED BY SERVER!
//b = (p->info.contains('Q') != 0);
//slot_checkbox(2, b);
// -> WORKAROUND
if (p->info.contains('Q') != 0)
slot_checkbox(2, true);
// get rank to calc handicap when matching
myAccount->set_rank(p->rank);
mark = "M";
}
}
// from WHO command or {... has connected}
if (extUserInfo && myAccount->get_gsname() == IGS)
{
PlayerTableItem *lv1 = new PlayerTableItem(ListView_players,
p->info,
p->name,
p->rank,
p->play_str,
p->obs_str,
p->idle,
mark,
p->extInfo,
p->won,
p->lost,
p->country,
p->nmatch_settings);
lv1->setText(12, rkToKey(p->rank) + p->name.lower());
lv1->set_nmatchSettings(p);
}
else
{
PlayerTableItem *lv1 = new PlayerTableItem(ListView_players,
p->info,
p->name,
p->rank,
p->play_str,
p->obs_str,
p->idle,
mark);
lv1->setText(12, rkToKey(p->rank) + p->name.lower());
lv1->set_nmatchSettings(p);
}
// increase number of players
myAccount->num_players++;
statusUsers->setText(" P: " + QString::number(myAccount->num_players) + " / " + QString::number(myAccount->num_watchedplayers) + " ");
//if (!cmdplayers)
// ListView_players->sort() ;
}
else
{
// {... has disconnected}
bool found = false;
for (QListViewItem *lvi; (lvi = lv.current()) && !found;)
{
lv++;
// compare names
if (lvi->text(1) == p->name)
{
// check if it was a watched player
if (lvi->text(6) == "W")
{
qgoif->get_qgo()->playLeaveSound();
myAccount->num_watchedplayers--;
}
lv++;
if (lvi == topViewItem) // are we trying to delete the 'anchor' of the list viewport ?
deleted_topViewItem = true ;
delete lvi;
found = true;;
// decrease number of players
myAccount->num_players--;
statusUsers->setText(" P: " + QString::number(myAccount->num_players) + " / " + QString::number(myAccount->num_watchedplayers) + " ");
}
}
if (!found)
qWarning("disconnected player not found: " + p->name);
}
if (! deleted_topViewItem) //don't try to refer to a deleted element ...
{
int ip = topViewItem->itemPos();
ListView_players->setContentsPos(0,ip);
}
}