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


C++ ListWidget::addItem方法代码示例

本文整理汇总了C++中ListWidget::addItem方法的典型用法代码示例。如果您正苦于以下问题:C++ ListWidget::addItem方法的具体用法?C++ ListWidget::addItem怎么用?C++ ListWidget::addItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ListWidget的用法示例。


在下文中一共展示了ListWidget::addItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onNewPlayerWithName

void OptionsScreenPlayers::onNewPlayerWithName(const stringw& newName)
{
    ListWidget* players = this->getWidget<ListWidget>("players");
    if (players != NULL)
    {
        core::stringc newNameC(newName.c_str());
        players->addItem( newNameC.c_str(), translations->fribidize(newName) );
    }
}
开发者ID:PalashBansal,项目名称:stk-code,代码行数:9,代码来源:options_screen_players.cpp

示例2: addTracks

/** Updates the list of tracks shown.
 */
void GPInfoScreen::addTracks()
{
    const std::vector<std::string> tracks = m_gp.getTrackNames();

    ListWidget *list = getWidget<ListWidget>("tracks");
    list->clear();
    for (unsigned int i = 0; i < (unsigned int)tracks.size(); i++)
    {
        const Track *track = track_manager->getTrack(tracks[i]);
        std::string s = StringUtils::toString(i);
        list->addItem(s, translations->fribidize(track->getName()));
    }
}   // addTracks
开发者ID:quantum0813,项目名称:stk-code,代码行数:15,代码来源:gp_info_screen.cpp

示例3: refreshPlayerList

/** Refreshes the list of players.
 */
bool OptionsScreenPlayers::refreshPlayerList()
{
    ListWidget* players = this->getWidget<ListWidget>("players");
    if (players == NULL) return false;
    // Get rid of previous
    players->clear();
    // Rebuild it
    const int player_amount = PlayerManager::get()->getNumPlayers();
    for (int i = 0; i < player_amount; i++)
    {
        // FIXME: Using a truncated ASCII string for internal ID. Let's cross
        // our fingers and hope no one enters two player names that,
        // when stripped down to ASCII, give the same identifier...
        const PlayerProfile *player = PlayerManager::get()->getPlayer(i);
        players->addItem(
            core::stringc(player->getName().c_str()).c_str(),
            translations->fribidize(player->getName()));
    }

    return true;
}
开发者ID:PalashBansal,项目名称:stk-code,代码行数:23,代码来源:options_screen_players.cpp

示例4: init

void StoryModeLobbyScreen::init()
{
    Screen::init();
    
    CheckBoxWidget* cb = getWidget<CheckBoxWidget>("rememberme");
    cb->setState(false);
    
    ListWidget* list = getWidget<ListWidget>("gameslots");
    list->clear();
    
    PtrVector<PlayerProfile>& players = UserConfigParams::m_all_players;
    
    if (UserConfigParams::m_default_player.toString().size() > 0)
    {
        for (int n=0; n<players.size(); n++)
        {
            if (players[n].getName() == UserConfigParams::m_default_player.toString())
            {
                unlock_manager->setCurrentSlot(players[n].getUniqueID());
                StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
                return;
            }
        }
    }
    
    for (int n=0; n<players.size(); n++)
    {
        if (players[n].isGuestAccount()) continue;
        
        // FIXME: we're using a trunacted ascii version of the player name as
        //        identifier, let's hope this causes no issues...
        list->addItem(core::stringc(players[n].getName().c_str()).c_str(),
                      players[n].getName() );
    }
    
    list->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
    list->setSelectionID(0);
    
}   // init
开发者ID:kiennguyen1994,项目名称:game-programming-cse-hcmut-2012,代码行数:39,代码来源:story_mode_lobby.cpp


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