本文整理汇总了C++中Icon::setContent方法的典型用法代码示例。如果您正苦于以下问题:C++ Icon::setContent方法的具体用法?C++ Icon::setContent怎么用?C++ Icon::setContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Icon
的用法示例。
在下文中一共展示了Icon::setContent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadIcons
void DesktopView::loadIcons()
{
QDir desktop(QDir::homePath()+"/Desktop");
desktop.setFilter(QDir::Files | QDir::NoDotAndDotDot);
desktop.setSorting(QDir::Size | QDir::Reversed);
QFileInfoList list = desktop.entryInfoList();
// d->iconWatcher->setFuture(QtConcurrent::mapped(list, LoadIcon(d->iconprovider, d->row, d->column)));
for (int i = 0; i < list.size(); i++) {
QFileInfo fileInfo = list.at(i);
QPixmap iconpixmap (DesktopWidget::applicationDirPath() +
"/share/plexy/skins/widgets/widget01/Icon.png");
//TODO
//Shared pointer please
Icon * icon = new Icon(d->iconprovider, QRect(0,0,iconpixmap.width(),iconpixmap.height()));
icon->setContent(fileInfo.absoluteFilePath());
if(icon->isValid()) {
scene()->addItem(icon);
icon->setPos(d->row,d->column);
icon->show();
d->icons.append(icon);
} else {
delete icon;
}
}
}
示例2: init
void BroadGameRankButton::init( Layer* parentLayer, PokerPlayerRankInfo* ptrFriendInfo, int index, bool isShowFriend )
{
initWithNormalSprite(m_ptrNormal, m_ptrSelected, NULL, parentLayer, NULL);
PokerPlayerRankInfo friendInfo;
if(ptrFriendInfo->account_id == GameUtils::s_myInfo.getAccountID())
{
friendInfo = *ptrFriendInfo;
friendInfo.onlineType = OFF_LINE;
ptrFriendInfo = &friendInfo;
}
if (ptrFriendInfo->account_id == GameUtils::s_myInfo.getAccountID())
{
CCScale9Sprite* ptrCellBgCover = GameUtils::createScale9("light_blue_bg.png",
CCRectMake(0,0,88,88),CCRectMake(30,30,25,25));
ptrCellBgCover->setContentSize(CCSizeMake(434,128));
ptrCellBgCover->setOpacity(0.5 * 255);
addChild(ptrCellBgCover);
LayoutUtil::layoutParentCenter(ptrCellBgCover);
}
// Rank
if(index <= 2 && index >= 0 && ptrFriendInfo->winCount > 0)
{
char buf[40] ;
sprintf(buf,"rank_%d.png",index + 1);
CCSprite* ptrCupSprite = CREATE_SPRITE(this,buf,true);
addChild(ptrCupSprite);
LayoutUtil::layoutParentCenter(ptrCupSprite, -123);
}
else if(index <= -1 || ptrFriendInfo->winCount == 0)
{
CCLabelTTF* ptrLbRank = CCLabelTTF::create("---",FontConstant::TTF_IMPACT,30);
addChild(ptrLbRank);
LayoutUtil::layoutParentCenter(ptrLbRank, -123);
}
else
{
char buf[10];
sprintf(buf, "%d", index + 1);
CCLabelTTF* ptrLbRank = CCLabelTTF::create(buf,FontConstant::TTF_IMPACT,30);
addChild(ptrLbRank);
LayoutUtil::layoutParentCenter(ptrLbRank, -123);
}
// Head Portrait
string photoPath;
GameUtils::getPhotoPath(photoPath,ptrFriendInfo->account_id,ptrFriendInfo->photo);
CCSprite* ptrHeadSprite = CREATE_SPRITE(this,photoPath.c_str(),true);
Icon* ptrIcon = Icon::create(86.0f);
addChild(ptrIcon);
ptrIcon->setContent(ptrHeadSprite);
ptrIcon->setStencil(CREATE_SPRITE(this,"photo_mask_clip.png",true));
LayoutUtil::layoutParentLeft(ptrIcon, 72);
ptrIcon->setCover(CREATE_SPRITE(this,"photo_mask.png",true));
// Name
string name = ptrFriendInfo->account_id == GameUtils::s_myInfo.getAccountID()
? GameUtils::s_myInfo.getNickName() : ptrFriendInfo->nickName;
name = GameUtils::cutName(name,12);
CCLabelTTF* ptrLbName = CCLabelTTF::create(name.c_str(), FontConstant::TTF_IMPACT, 22);
ptrLbName->setDimensions(CCSizeMake(145,ptrLbName->getContentSize().height));
ptrLbName->setHorizontalAlignment(kCCTextAlignmentLeft);
addChild(ptrLbName);
LayoutUtil::layoutParentLeftTop(ptrLbName, 172, -10);
if(!isShowFriend)
{
// Win
CCLabelTTF* ptrLbWin = CCLabelTTF::create(LOCALIZED_STRING("win_label"),
FontConstant::TTF_IMPACT,24);
ptrLbWin->setColor(ccc3(255,234,0));
addChild(ptrLbWin);
LayoutUtil::layoutParentLeftTop(ptrLbWin, 172, -43);
// Win Count
CCLabelTTF* ptrLbWinCount = CCLabelTTF::create(
Utils::num2strF(ptrFriendInfo->winCount,8,",",false).c_str(),
FontConstant::TTF_IMPACT, 22);
ptrLbWinCount->setColor(ccc3(0,255,255));
addChild(ptrLbWinCount);
LayoutUtil::layoutRight(ptrLbWinCount, ptrLbWin);
}
else
{
if(ptrFriendInfo->onlineType == ON_LINE_NORMAL)
{
// Icon
CCSprite* ptrGreenIcon = CREATE_SPRITE(this, "ico_green.png", true);
addChild(ptrGreenIcon);
LayoutUtil::layoutParentLeftTop(ptrGreenIcon, 166, -43);
}
else
{
CCLabelTTF* ptrLbWin = CCLabelTTF::create(LOCALIZED_STRING("win_label"),
FontConstant::TTF_IMPACT,24);
ptrLbWin->setColor(ccc3(255,234,0));
addChild(ptrLbWin);
LayoutUtil::layoutParentLeftTop(ptrLbWin, 172, -43);
//.........这里部分代码省略.........