当前位置: 首页>>代码示例>>C++>>正文


C++ QListViewItem::itemPos方法代码示例

本文整理汇总了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);
	}
}
开发者ID:rd8,项目名称:qGo,代码行数:101,代码来源:tables.cpp


注:本文中的QListViewItem::itemPos方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。