• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ createItem函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中createItem函数的典型用法代码示例。如果您正苦于以下问题:C++ createItem函数的具体用法?C++ createItem怎么用?C++ createItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: createArray

aJsonObject*
aJsonClass::createDoubleArray(double *numbers, unsigned char count)
{
  unsigned char i;
  aJsonObject *n = 0, *p = 0, *a = createArray();
  for (i = 0; a && i < count; i++)
    {
      n = createItem(numbers[i]);
      if (!i)
        a->child = n;
      else
        suffixObject(p, n);
      p = n;
    }
  return a;
}
开发者ID:EpsilonEpsilonChi,项目名称:BoozeBot,代码行数:16,代码来源:aJSON.cpp


示例2: rowAndColumn

/*!
  \fn void PhoneLauncherView::setCurrentItem(int idx)
  Causes the item positioned at the given index to become the current item. If \a idx is
  invalid, no change will occur.
  \a idx: The index of a GridItem object.
*/
void PhoneLauncherView::setCurrentItem(int idx)
{
    if ( selectedItem ) {
        // Calculate the row and column of the required item according to the index.
        int row, column;
        rowAndColumn(idx,row,column);

        // Make sure we've actually got an item for that row and column, even if it's
        // an item with empty content.
        GridItem *item = selectedItem->item(row,column);
        if ( !item ) {
            item = createItem(0,row,column);
        }

        selectedItem->setCurrent(item,false); // 2nd param means no animation
    }
}
开发者ID:Camelek,项目名称:qtmoko,代码行数:23,代码来源:phonelauncherview.cpp


示例3: getHeight

const std::vector<KotORWidget *> &WidgetListBox::createItemWidgets(uint count) {
	if (!_protoItem)
		throw Common::Exception("ListBox widget has no PROTOITEM");

	const int64 itemHeight = _protoItem->getStruct("EXTENT").getSint("HEIGHT");

	uint widgetCount = count;
	if ((count == 0) && (itemHeight > 0))
		widgetCount = getHeight() / itemHeight;

	for (uint i = 0; i < widgetCount; ++i) {
		Common::UString name = Common::UString::format("%s_ITEM_%u", _tag.c_str(), i);
		createItem(name);
	}

	return _itemWidgets;
}
开发者ID:berenm,项目名称:xoreos,代码行数:17,代码来源:listbox.cpp


示例4: assert

void ObjectsScene::updateRadius(int id, BaseType r)
{
    auto obj = m_objects.find(id);
    assert(obj != m_objects.end());

    QGraphicsItem* item = createItem(r);
    item->setData(ObjectData::Id, id);
    item->setData(ObjectData::Radius, r);

    const QPointF pos = obj->second->pos();
    item->setPos(pos);

    // swap items
    removeItem(obj->second);
    delete obj->second;
    obj->second = item;
}
开发者ID:Kicer86,项目名称:gravity_simulator,代码行数:17,代码来源:objects_scene.cpp


示例5: _clear

bool MgRecordShape::load(MgShapeFactory* factory, MgStorage* s)
{
    _clear();
    
    _sid = s->readInt("refid", _sid);
    for (int i = 0; s->readNode("p", i, false); i++) {
        ICmd* item = createItem(s->readInt("type", 0));
        
        if (item && item->load(s)) {
            _items.push_back(item);
        } else {
            delete item;
        }
        s->readNode("p", i, true);
    }
    return _load(factory, s);
}
开发者ID:shuangyou,项目名称:TouchVGCore,代码行数:17,代码来源:girecordcanvas.cpp


示例6: createItem

void QProjectPropertiesDialog::createIcons()
{
    map.insert(createItem(contentsWidget,tr("General")),pagesWidget->widget(0));
    map.insert(createItem(contentsWidget,tr("Compiler")),pagesWidget->widget(1));

    QTreeWidgetItem *configButton = createItem(contentsWidget,tr("Windows Types"));
    map.insert(configButton,pagesWidget->widget(2));

    map.insert(createItem(configButton,tr("Buttons")),pagesWidget->widget(3));
    map.insert(createItem(configButton,tr("Position")),pagesWidget->widget(4));
    map.insert(createItem(configButton,tr("Navgation Panel")),pagesWidget->widget(5));
    map.insert(createItem(configButton,tr("Styles")),pagesWidget->widget(6));

    map.insert(createItem(contentsWidget,tr("Merge Files")),pagesWidget->widget(7));

    connect(contentsWidget,
            SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
            this, SLOT(changePage(QTreeWidgetItem *, QTreeWidgetItem*)));
}
开发者ID:jagens,项目名称:chmcreator,代码行数:19,代码来源:configdialog.cpp


示例7: createHeading

MenuMain::MenuMain(){
	AG_Box * item;

	// nadpis
	createHeading("Nabídka dne");
	// TODO resume to game

	// new game
	item = createItem("New game");
	AG_SetEvent(item, "window-mousebuttondown", MenuNewGame::create, 0);

	// load game
	item = createItem("Load game");
	AG_SetEvent(item, "window-mousebuttondown", MenuLoadGame::create, 0);

	// TODO save game

	// deathmatch
	item = createItem("Deathmatch");
	AG_SetEvent(item, "window-mousebuttondown", MenuDeathmatch::create, 0);

	// creatures
	item = createItem("Creatures");
	AG_SetEvent(item, "window-mousebuttondown", MenuCreatures::create, 0);
	// bonuses
	item = createItem("Bonuses");
	AG_SetEvent(item, "window-mousebuttondown", MenuBonuses::create, 0);
	// credits
	item = createItem("Credits");
	AG_SetEvent(item, "window-mousebuttondown", MenuCredits::create, 0);

	// options
	item = createItem("Options");
	AG_SetEvent(item, "window-mousebuttondown", MenuOptions::create, 0);

	// quit
// 	AG_SpacerNewHoriz(win);
	item = createItem("Quit");
	AG_SetEvent(item, "window-mousebuttondown", handlerBack, 0);

	AG_SpacerNewHoriz(win);
}
开发者ID:jirkadanek,项目名称:bombic2,代码行数:42,代码来源:menu_main.cpp


示例8: OfflineFirstFit

void OfflineFirstFit(ListP listPtr, int *allItems, int itemsInRun){
	int j, currentItem, currentBin;
	ItemP item;

	// sort allItems
	mergeSort(allItems, itemsInRun);

	// create items and pack
	rewind(fpBins); // ensure every algorithm starts with the same Bin
	fscanf(fpBins, "%d", &currentBin);
	addBinToList(listPtr, currentBin);
	for (j = 0; j < itemsInRun; j++){
		currentItem = allItems[j];
		item = createItem(currentItem);
		FirstFit(listPtr, item);
	}
	return;
}
开发者ID:quanshengxixin,项目名称:Project4_BinPacking,代码行数:18,代码来源:Greedy.c


示例9: currentItem

void PopupMenuEditor::enterEditMode( QKeyEvent * e )
{
    PopupMenuEditorItem * i = currentItem();

    if ( i == &addSeparator ) {
	i = createItem( new QSeparatorAction( 0 ) );
    } else if ( i->isSeparator() ) {
	return;
    } else if ( currentField == 0 ) {
	choosePixmap();
    } else if ( currentField == 1 ) {
	showLineEdit();
	return;
    } else {// currentField == 2
	setAccelerator( e->key(), e->state() );
    }
    showSubMenu();
    return;
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:19,代码来源:popupmenueditor.cpp


示例10: _beginthread

/**
 *\fn           void runSftp(const char *path)
 *\brief        运行SFTP客户端
 *\param[in]    const char * path
 *\return       void 无
 */
void CBrowseWnd::runSftp(const char *path)
{
    _beginthread(sftp_thread_func, 0, &ssh_param_);

    // 等待连接完成
    for (int i = 0; i < 100; i++)
    {
        if (NULL != ssh_param_.channel) break;
        Sleep(100);
    }

    if (NULL == path) return;

    HTREEITEM item = createItem(path);

    updateFileList(item);

    processExpand_ = true;
}
开发者ID:xt9852,项目名称:TestSet,代码行数:25,代码来源:BrowseWnd.cpp


示例11: shouldListTagItems

    void shouldListTagItems()
    {
        // GIVEN
        auto data = Testlib::AkonadiFakeData();
        auto t1 = Akonadi::Tag(42);
        t1.setName(QStringLiteral("42"));
        data.createTag(t1);

        auto i1 = Akonadi::Item(42);
        i1.setPayloadFromData("42");
        i1.setTag(Akonadi::Tag(42));

        // WHEN
        data.createItem(i1);

        // THEN
        QCOMPARE(data.tagItems(t1.id()).size(), 1);
        QCOMPARE(data.tagItems(t1.id()).at(0), i1);
    }
开发者ID:KDE,项目名称:zanshin,代码行数:19,代码来源:akonadifakedatatest.cpp


示例12: shouldListChildItems

    void shouldListChildItems()
    {
        // GIVEN
        auto data = Testlib::AkonadiFakeData();
        auto c1 = Akonadi::Collection(42);
        c1.setName(QStringLiteral("42"));
        data.createCollection(c1);

        auto i1 = Akonadi::Item(42);
        i1.setPayloadFromData("42");
        i1.setParentCollection(Akonadi::Collection(42));

        // WHEN
        data.createItem(i1);

        // THEN
        QCOMPARE(data.childItems(c1.id()).size(), 1);
        QCOMPARE(data.childItems(c1.id()).at(0), i1);
    }
开发者ID:KDE,项目名称:zanshin,代码行数:19,代码来源:akonadifakedatatest.cpp


示例13: createItem

void CSceneExplorer::update(const CNodeChangeInfo &change)
{
	QStandardItem *item;

	if(change.getInfoType() == CNodeChangeInfo::ENCIT_CREATED)
	{
		ENodeType type = change.getType();

		QStandardItem *parentItem = 0;
		item = createItem(change.getId(), type, QString(change.getName().c_str()));

		m_idToItemMap[change.getId()] = item;

		if(type & PROP_BIT)
		{
			parentItem = m_propItem;
		}
		else if(type & LOGIC_BIT)
		{
			parentItem = m_logicItem;
		}
		else if(type == ENT_LIGHT)
		{
			parentItem = m_lightItem;
		}
		else if(type == ENT_MAP)
		{
			parentItem = m_mapItem;
		}

		if(parentItem)
		{
			parentItem->appendRow(item);
		}
	}
	else if(change.getInfoType() == CNodeChangeInfo::ENCIT_REMOVED)
	{
		item = m_idToItemMap[change.getId()];
		removeStandardItem(item);
		m_idToItemMap.erase(change.getId());
	}
}
开发者ID:creepydragon,项目名称:revision1,代码行数:42,代码来源:CSceneExplorer.cpp


示例14: AGE_ASSERT

	void BFCBlockManager::createItem(BFCCullableObject *object, BlockID &blockID, ItemID &itemId)
	{
		
		if (_blocksNotFull.empty() == false)
		{
			auto b = *(_blocksNotFull.begin());
			auto &block = _blocks[b];
			itemId = block->createItem(object);
			blockID = std::uint8_t(b);
			if (block->isFull())
			{
				_blocksNotFull.erase(_blocksNotFull.begin());
			}
			return;
		}
		_blocks.push_back(std::make_shared<BFCBlock>());
		AGE_ASSERT(_blocks.size() < MaxBlockID);
		_blocksNotFull.insert(_blocks.size() - 1);
		createItem(object, blockID, itemId);
	}
开发者ID:Another-Game-Engine,项目名称:AGE,代码行数:20,代码来源:BFCBlockManager.cpp


示例15: removeItemFromRandomShooter

void ItemSpawningLogic::tick2() {
    if(ItemExisting == true) {
        spawnCountdown -= 1;

        // the feature item shall be deleted after a given time
        if(spawnCountdown <= 0) {
                removeItemFromRandomShooter();
        }
    }

    else {
        // create a feature item after a random number of clock ticks
        int randomcreation = rand() % 10;

        if(randomcreation == 0) {
            createItem();
            resetSpawnCountdown();
        }
    }
}
开发者ID:haagflo,项目名称:Qt2D-Shooter,代码行数:20,代码来源:itemspawninglogic.cpp


示例16: Q_ASSERT

void QDeclarativeGeoMapObjectView::modelRowsInserted(QModelIndex, int start, int end)
{
    if (!componentCompleted_ || !map_ || !map_->mapData_ || !delegate_ || !model_)
        return;
    Q_ASSERT(declarativeObjectList_.count() == group_.childObjects().count());
    QDeclarativeGeoMapObject* mapObject;
    for (int i = start; i <= end; ++i) {
        mapObject = createItem(i);
        if (!mapObject) {
            break;
        }
        declarativeObjectList_.append(mapObject);
        mapObject->setVisible(visible_);
        mapObject->setMap(map_);
        group_.addChildObject(mapObject->mapObject());
        // Needed in order for mouse areas to work.
        map_->objectMap_.insert(mapObject->mapObject(), mapObject);
    }
    Q_ASSERT(declarativeObjectList_.count() == group_.childObjects().count());
}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:20,代码来源:qdeclarativegeomapobject.cpp


示例17: createItem

void RunInfoTree::parseFolderElement(const QDomElement &element,
								  QTreeWidgetItem *parentItem)
{
	QTreeWidgetItem *item = createItem(element, parentItem);
	QDomElement child = element.firstChildElement();
	item->setFlags(item->flags() | Qt::ItemIsEditable);
	item->setText(0, element.tagName());
	item->setText(1, element.attribute("value"));	
	if(child.isNull()){
		item->setIcon(0, bookmarkIcon);
		item->setText(1,element.attribute("value"));
		return;
	}
	item->setIcon(0, folderIcon);
		
	while (!child.isNull()) {
		parseFolderElement(child,item); //recursive call
		child = child.nextSiblingElement();		
	}
}
开发者ID:jesloper,项目名称:CGP,代码行数:20,代码来源:RunInfoTree.cpp


示例18: insertIt

void insertIt(Item **base, char *name, char *desc, int price, char *shelf, int amount) {
  
  Item **item = &(*base);
  int size = itemCount(base);
  int c = 0;
  Item **items[size];
  
  while((*item) != NULL) {
    items[c] = item;
    if (strcmp(name, (*item)->name) < 0) {
      item = &(*item)->left;
    } else if (strcmp(name, (*item)->name) > 0) {
      item = &(*item)->right;
    } else if (strcmp(name, (*item)->name) == 0) {
      addToShelves((*item)->shelves, shelf, amount);
      break;
    }
    
    ++c;
    
  }
  
  if ((*item) == NULL) {
    (*item) =  createItem(name, desc, price, shelf, amount);
  }
  
  for (int i = c; i >= 0; i--) {

    (*item)->height = max(getHeight((*item)->left), getHeight((*item)->right)) +1;

    int balanceFactor = getBalance(*item);
  
    if (balanceFactor < -1 || balanceFactor > 1) {
      balance(item, name, balanceFactor);
    }

  }


}
开发者ID:Tw1stedL0gic,项目名称:IOOPM-jojoca,代码行数:40,代码来源:whItem.c


示例19: LOG

void HistoryController::updateForRedirectWithLockedBackForwardList()
{
#if !LOG_DISABLED
    if (m_frame.loader().documentLoader())
        LOG(History, "WebCoreHistory: Updating History for redirect load in frame %s", m_frame.loader().documentLoader()->title().string().utf8().data());
#endif
    
    bool needPrivacy = m_frame.page()->usesEphemeralSession();
    const URL& historyURL = m_frame.loader().documentLoader()->urlForHistory();

    if (m_frame.loader().documentLoader()->isClientRedirect()) {
        if (!m_currentItem && !m_frame.tree().parent()) {
            if (!historyURL.isEmpty()) {
                updateBackForwardListClippedAtTarget(true);
                if (!needPrivacy) {
                    m_frame.loader().client().updateGlobalHistory();
                    m_frame.loader().documentLoader()->setDidCreateGlobalHistoryEntry(true);
                    if (m_frame.loader().documentLoader()->unreachableURL().isEmpty())
                        m_frame.loader().client().updateGlobalHistoryRedirectLinks();
                }

                m_frame.loader().client().updateGlobalHistoryItemForPage();
            }
        }
        // The client redirect replaces the current history item.
        updateCurrentItem();
    } else {
        Frame* parentFrame = m_frame.tree().parent();
        if (parentFrame && parentFrame->loader().history().currentItem())
            parentFrame->loader().history().currentItem()->setChildItem(createItem());
    }

    if (!historyURL.isEmpty() && !needPrivacy) {
        if (Page* page = m_frame.page())
            addVisitedLink(*page, historyURL);

        if (!m_frame.loader().documentLoader()->didCreateGlobalHistoryEntry() && m_frame.loader().documentLoader()->unreachableURL().isEmpty() && !m_frame.document()->url().isEmpty())
            m_frame.loader().client().updateGlobalHistoryRedirectLinks();
    }
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:40,代码来源:HistoryController.cpp


示例20: resizeevent

/*!
  \fn void PhoneLauncherView::addItem(QContent* content, int pos)
  Creates a new GridItem object and adds it to the scene, or else updates the GridItem
  at the given position, if it already exists. When a new GridItem object is added,
  its position and size will be calculated and set in response to resizeevent(...).
  When an existing GridItem object is modified, its position and size do not
  change in response to \a content -- position and size are determined by other factors,
  such as the size of the view and the current resolution.

  \a content: Contains information to be used by the GridItem object, such as the
  Icon used to display it, the name of its underlying application, etc.
  \a pos: The index of the GridItem object, which will be converted into a
  row and a column position.
*/
void PhoneLauncherView::addItem(QContent* content, int pos)
{
    if ( !selectedItem ) {
        qWarning("PhoneLauncherView::addItem(...): Could not add GridItem for pos %d - no selected item.",pos);
        return;
    }

    // Calculate row and column from pos.
    int row, column;
    rowAndColumn(pos,row,column);

    GridItem *item = 0;
    if ( (item = selectedItem->item(row,column)) ) {
        // Already have an item for that row and column. That means we need to update it, not
        // create it.
        item->setContent(content);
        scene->update();
    } else {
        // Create the new GridItem object.
        createItem(content,row,column);
    }
}
开发者ID:Camelek,项目名称:qtmoko,代码行数:36,代码来源:phonelauncherview.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ createLabel函数代码示例发布时间:2022-05-30
下一篇:
C++ createIndex函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap