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


C++ QVector::insert方法代码示例

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


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

示例1: manageInterface

void UmlComponent::manageInterface(Token & token, FileIn & in) {
  QCString idref = token.valueOf("supplier");
  
  QMap<QCString, UmlItem *>::Iterator it = All.find(idref);
  int c = ((const char *) token.what())[0];
  
  if (it != All.end()) {
    if ((*it)->kind() == aClass) {
      if (c == 'i') {
	// provided
	QVector<UmlClass> provided = providedClasses();
	unsigned sz = provided.size();
	
	provided.resize(sz + 1);
	provided.insert(sz, (UmlClass *) *it);
	set_AssociatedClasses(realizingClasses(), provided, requiredClasses());
      }
      else {
	// realization
	QVector<UmlClass> realizing = realizingClasses();
	unsigned sz = realizing.size();
	
	realizing.resize(sz + 1);
	realizing.insert(sz, (UmlClass *) *it);
	set_AssociatedClasses(realizing, providedClasses(), requiredClasses());
      }
    }
  }
  else
    UnresolvedWithContext::add(this, idref, c);
    
  if (! token.closed())
    in.finish(token.what());
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例2: solve

void UmlComponent::solve(int context, QCString idref) {
  QMap<QCString, UmlItem *>::Iterator it = All.find(idref);
  
  if (it != All.end()) {
    if ((*it)->kind() == aClass) {
      if (context == 'i') {
	// provided
	QVector<UmlClass> provided = providedClasses();
	unsigned sz = provided.size();
	
	provided.resize(sz + 1);
	provided.insert(sz, (UmlClass *) *it);
	set_AssociatedClasses(realizingClasses(), provided, requiredClasses());
      }
      else {
	// realization
	QVector<UmlClass> realizing = realizingClasses();
	unsigned sz = realizing.size();
	
	realizing.resize(sz + 1);
	realizing.insert(sz, (UmlClass *) *it);
	set_AssociatedClasses(realizing, providedClasses(), requiredClasses());
      }
    }
  }
  else if (!FileIn::isBypassedId(idref))
    UmlCom::trace("component : unknown reference '" + idref + "'<br>");
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例3: addVersionItem

void FileListDownload::addVersionItem( QVector<VersionListItem*>& vct, VersionListItem* pItem )
{
    for( int i = 0; i < vct.size(); i++ )
    {
        QString strFilePath;
        if(pItem->m_strFileVersion.isEmpty())
        {
            if( vct[i]->m_fSizeKb <= pItem->m_fSizeKb )
            {
                vct.insert( i, pItem );
                return;
            }
        }
        else
        {
            if( VersionListItem::isGreaterVersion( pItem->m_strFileVersion, vct[i]->m_strFileVersion ) )
            {
                vct.insert( i, pItem );
                return;
            }
        }


    }

    vct.push_back(pItem);
}
开发者ID:ndsl0827,项目名称:Repairer,代码行数:27,代码来源:filelistdownload.cpp

示例4: snakelong

void snakelong(Mat &dst,Point p){
    QVector<Point> snakeLineTemp;
    snakeLineTemp=snakeLine;
    snakeLine.insert(0,p);
    for(int a=1;a<snakeLength;a++){
        snakeLine.insert(a,snakeLineTemp.at(a-1));
        circle(dst,snakeLine.at(a),15,Scalar( 255, 0, 0 ),-1,8);
    }
}
开发者ID:MyandMine,项目名称:GoodJob,代码行数:9,代码来源:main.cpp

示例5: sql

//***提取测试记录
QVector<testRecord> CDatabase::getTest(QString id)
{
    QVector<testRecord> t;

    QSqlQuery sql(_db);
    sql.exec("select * from test where meter='" + id + "'");
    int i=0;
    while(sql.next())
    {
        testRecord a;
        a._id       = sql.value(0).toInt();
        a._meter    = sql.value(1).toString();
        a._user     = sql.value(2).toString();
        a._date     = sql.value(3).toInt();
        a._inittest = sql.value(4).toInt();
        a._fulltest = sql.value(5).toInt();
        a._adjusttest   = sql.value(6).toInt();
        a._functiontest = sql.value(7).toInt();
        a._comment      = sql.value(8).toString();

        t.insert(i++,1,a);
    }

    return t;
}
开发者ID:jiacheng2012,项目名称:311_tester,代码行数:26,代码来源:cdatabase.cpp

示例6: AddRecord

/**
 * @brief AddRecord add record about tool in history.
 * @param id object id in container
 * @param toolType tool type
 * @param doc dom document container
 */
void VAbstractTool::AddRecord(const quint32 id, const Tool &toolType, VPattern *doc)
{
    QVector<VToolRecord> *history = doc->getHistory();
    VToolRecord record = VToolRecord(id, toolType, doc->GetNameActivPP());
    if (history->contains(record))
    {
        return;
    }

    quint32 cursor = doc->getCursor();
    if (cursor <= 0)
    {
        history->append(record);
    }
    else
    {
        qint32 index = 0;
        for (qint32 i = 0; i<history->size(); ++i)
        {
            VToolRecord rec = history->at(i);
            if (rec.getId() == cursor)
            {
                index = i;
                break;
            }
        }
        history->insert(index+1, record);
    }
}
开发者ID:a-dilla,项目名称:Valentina,代码行数:35,代码来源:vabstracttool.cpp

示例7: insertRows

bool FileModel::insertRows(int row, int count, const QModelIndex &parent)
{
    if (count <= 0)
        return true; // Successfully added 0 rows.

    QVector<Entry *> entries = entryList;
    Entry *entry = NULL;
    QString data;
    QString name;
    QDateTime modification;

    for (int i = row; i < row + count; i++) {
        data = Utils::getTextFromFile(i);
        name = Utils::getFileName(i);
        modification = Utils::getModificationDate(i);

        entry = new Entry(name, data, modification, i);

        if (entry)
            entries.insert(i, entry);
    }

    QStringList entriesList;
    foreach (Entry *entry, entries) {
        Q_ASSERT(entry);
        if (selectedBuckets)
            entriesList << entry->getFileData();
        else
            entriesList << entry->getModificationDate().toString("dd MMMM yyyy");
    }
开发者ID:arcean,项目名称:text-editor,代码行数:30,代码来源:filemodel.cpp

示例8: merge_vec_to_vec

void merge_vec_to_vec(const QVector<word_t*>& src, QVector<word_t*>& target)
{
	bool bInserted = false;
	for (int i = 0; i < src.size(); ++i)
	{
		for (int j = 0; j < target.size(); ++j)
		{
			if (src[i]->name == target[j]->name)
			{
				target[j]->marks += src[i]->marks;
				bInserted = true;
				break;
			}
			else if (src[i]->name > target[j]->name)
			{
				target.insert(j, new word_t(*src[i]));
				bInserted = true;
				break;
			}
		}
		if (!bInserted)
		{
			target.append(new word_t(*src[i]));
		}
	}
}
开发者ID:Ryzh,项目名称:voc,代码行数:26,代码来源:main.cpp

示例9: addToRegChain

void EziDebugScanChain::addToRegChain(QString clock ,int chainNum , const QStringList& reglist)
{
    QVector<QStringList> iregListVec  = m_iregChainStructure.value(clock) ;
    int i = 0 ;

    qDebug() << "EziDebug Info: The insert chain number:" << chainNum  ;

    if(iregListVec.count())
    {
        for(i = 0 ; i < iregListVec.count() ; i++)
        {
            // 加入到 未完毕的链
            if(i == chainNum)
            {
                QStringList ioriginRegList = iregListVec.at(i) ;
                ioriginRegList << reglist ;
                iregListVec.replace(i,ioriginRegList);
                m_iregChainStructure.insert(clock,iregListVec);
                break ;
            }
        }
        // 新增链
        if(i == iregListVec.count())
        {
            // 新增 链
            if(chainNum != iregListVec.count())
            {
                qDebug() << "EziDebug Error: the reglist is insert chain number:" << chainNum  <<" is not equal to total number:" << iregListVec.count() ;
            }
            iregListVec.insert(chainNum ,reglist);
            m_iregChainStructure.insert(clock,iregListVec);
        }
    }
    else
    {
       if(chainNum != 0)
       {
           qDebug() << "EziDebug Error: the reglist is insert chain number:" << chainNum  <<" is not right" ;
       }
       iregListVec.insert(0,reglist);
       m_iregChainStructure.insert(clock,iregListVec);
    }

    return ;
}
开发者ID:freecores,项目名称:ezidebug,代码行数:45,代码来源:ezidebugscanchain.cpp

示例10: getConfiguration

Configuration* NewPointMethodLeppBisection::getConfiguration(){
    Configuration* ret;
    int i;
    Vertex* a;
    Vertex* b;
    Point* p;
    QVector<Point*> ps;
    QVector<int>    es;
    Triangle *t, *t1, *t2;

    QVector<Triangle*> lepp = this->tp->lepp();
    t1 = lepp.last();
    t2 = t1->neighbour(t1->getLongestEdge());

    if( t1->isConstrained(t1->getLongestEdge()) || (!t1->isConstrained(t1->getSecondLongestEdge()) && t2 != 0 && !t2->isConstrained(t2->getSecondLongestEdge())) ){
        i = t1->getLongestEdge();
        a = t1->vertex((i+1)%3);
        b = t1->vertex((i+2)%3);
        t = t1;
    }
    else{
        if( t1->isConstrained(t1->getSecondLongestEdge()) ){
            i = t1->getSecondLongestEdge();
            a = t1->vertex((i+1)%3);
            b = t1->vertex((i+2)%3);
            t = t1;
        }
        else if(t2 != 0 && t2->isConstrained(t2->getSecondLongestEdge())){
            i = t2->getSecondLongestEdge();
            a = t2->vertex((i+1)%3);
            b = t2->vertex((i+2)%3);
            t = t2;
        }
        else
            throw QString("aaaaaaaaaa");
    }

    p = Util::midpoint(a, b);
    ps.insert(0, p);
    es.insert(0, i);

    ret = new Configuration(this->mp, t, ps, es, Constant::BORDER_INCLUDED);

    return ret;
}
开发者ID:afaundez,项目名称:mesh-suite,代码行数:45,代码来源:NewPointMethodLeppBisection.cpp

示例11: insertRows

bool QtTestModel::insertRows(int row, int count, const QModelIndex &parent)
{
    QAbstractItemModel::beginInsertRows(parent, row, row + count - 1);
    int cc = columnCount(parent);
    table.insert(row, count, QVector<QString>(cc));
    rCount = table.count();
    QAbstractItemModel::endInsertRows();
    return true;
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例12: undo

void SCmdPathRemovePoint::undo()
{
    QVector<SEditPoint*>* editPoints = _manager->getEditPoints();
    SEditPointPath* editPoint = new SEditPointPath(_point);
    _scene->addItem(editPoint);
    editPoints->insert(_numPoint, editPoint);

    _graphicsItem->path()->insertPoint(_numPoint, _point);
    _graphicsItem->recomputeGeometry();
}
开发者ID:jobar,项目名称:shimmer,代码行数:10,代码来源:scmdpathremovepoint.cpp

示例13: applyButtonSlot

void ColorWidget::applyButtonSlot()
{
    QVector<QColor> colrVect;
    for(int i = 0 ; i < 12 ; i++)
    {
        colrVect.insert(i,ptrVector->at(i)->color());
    }
    emit setColor(this->ui->backLabel->color(),this->ui->textLabel->color(),
                  ui->gridLabel->color(),colrVect);
}
开发者ID:Qt-Widgets,项目名称:uav,代码行数:10,代码来源:colorwidget.cpp

示例14: insertColumns

/*!
    \fn void QTextTable::insertColumns(int index, int columns)

    Inserts a number of \a columns before the column with the specified \a index.

    \sa insertRows() resize() removeRows() removeColumns() appendRows() appendColumns()
*/
void QTextTable::insertColumns(int pos, int num)
{
    Q_D(QTextTable);
    if (num <= 0)
	return;

    if (d->dirty)
        d->update();

    if (pos > d->nCols || pos < 0)
        pos = d->nCols;

//     qDebug() << "-------- insertCols" << pos << num;
    QTextDocumentPrivate *p = d->pieceTable;
    QTextFormatCollection *c = p->formatCollection();
    p->beginEditBlock();

    for (int i = 0; i < d->nRows; ++i) {
        int cell;
        if (i == d->nRows - 1 && pos == d->nCols)
            cell = d->fragment_end;
        else
            cell = d->grid[i*d->nCols + pos];
        QTextDocumentPrivate::FragmentIterator it(&p->fragmentMap(), cell);
        QTextCharFormat fmt = c->charFormat(it->format);
        if (pos > 0 && pos < d->nCols && cell == d->grid[i*d->nCols + pos - 1]) {
            // cell spans the insertion place, extend it
            fmt.setTableCellColumnSpan(fmt.tableCellColumnSpan() + num);
            p->setCharFormat(it.position(), 1, fmt);
        } else {
            fmt.setTableCellRowSpan(1);
            fmt.setTableCellColumnSpan(1);
            Q_ASSERT(fmt.objectIndex() == objectIndex());
            int position = it.position();
            int cfmt = p->formatCollection()->indexForFormat(fmt);
            int bfmt = p->formatCollection()->indexForFormat(QTextBlockFormat());
            for (int i = 0; i < num; ++i)
                p->insertBlock(QTextBeginningOfFrame, position, bfmt, cfmt, QTextUndoCommand::MoveCursor);
        }
    }

    QTextTableFormat tfmt = format();
    tfmt.setColumns(tfmt.columns()+num);
    QVector<QTextLength> columnWidths = tfmt.columnWidthConstraints();
    if (! columnWidths.isEmpty()) {
        for (int i = num; i > 0; --i)
            columnWidths.insert(pos, columnWidths[qMax(0, pos-1)]);
    }
    tfmt.setColumnWidthConstraints (columnWidths);
    QTextObject::setFormat(tfmt);

//     qDebug() << "-------- end insertCols" << pos << num;
    p->endEditBlock();
}
开发者ID:Fale,项目名称:qtmoko,代码行数:61,代码来源:qtexttable.cpp

示例15: return

QVector<Command_Helper::defaultCMD_Structure> Command_Helper::getcmdstructure_TakeOff(const GPS_Position &currentGPS)
{
    QVector<defaultCMD_Structure> returnVector;

    defaultCMD_Structure defaultReturn;

    defaultReturn.parameterName = "Takeoff Pitch";

    returnVector.insert(0 , defaultReturn);

    defaultReturn.parameterName = "";
    defaultReturn.enabled = false;

    returnVector.insert(1 , defaultReturn);
    returnVector.insert(2 , defaultReturn);
    returnVector.insert(3 , defaultReturn);

    defaultReturn.enabled = true;

    defaultReturn.defaultValue = currentGPS.Latitude;
    defaultReturn.parameterName = "Latitude";
    returnVector.insert(4 , defaultReturn);

    defaultReturn.defaultValue = currentGPS.Longitude;
    defaultReturn.parameterName = "Longitude";
    returnVector.insert(5 , defaultReturn);

    defaultReturn.defaultValue = 5.0;
    defaultReturn.parameterName = "Altitude (m)";
    returnVector.insert(6 , defaultReturn);

    return(returnVector);

}
开发者ID:majorpr13,项目名称:SwarmingVehicles,代码行数:34,代码来源:command_helper.cpp


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