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


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

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


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

示例1: performProcessing

triState numColorsBaseModes::performProcessing(QImage* image, int numColors,
                                               int numImageColors) {

  colorTransformerPtr transformer =
    colorTransformer::createColorTransformer(flossMode());
  QVector<triC> newColors = ::chooseColors(*image, numColors,
                                           clickedColorList(),
                                           numImageColors,
                                           transformer);
  if (!newColors.empty()) {
    // remove the seed colors from newColors to create generatedColors
    const QVector<triC>& seedColors = clickedColorList();
    QVector<triC> generatedColors = newColors;
    for (int i = 0, size = seedColors.size(); i < size; ++i) {
      generatedColors.remove(generatedColors.indexOf(seedColors[i]));
    }
    setGeneratedColorList(generatedColors);
  }
  else {
    return triNoop;
  }
  if (!::segment(image, newColors, numImageColors).empty()) {
    //return triState(colorList().size() != savedColorsSize);
    return triTrue;
  }
  else {
    return triNoop;
  }
}
开发者ID:angelagabereau,项目名称:Cstitch,代码行数:29,代码来源:colorChooserProcessModes.cpp

示例2: Delete

bool tManagerPrivate::Delete(tBridge bridge)
{
    // Oh FFS, this would be a one liner in C++11
    QVector<tBridge> toSave = AllBridges();

    const int size = toSave.size();
    bool found = false;
    for (int i = 0; i < size; ++i)
    {
        if (IsIdEqual(toSave[i], bridge))
        {
            toSave.remove(i);
            found = true;
            break;
        }
    }

    if (!found)
    {
        return false;
    }    
    
    SaveToSharedStorage(toSave);

    return true;
}
开发者ID:dulton,项目名称:53_hero,代码行数:26,代码来源:tManagerPrivate.cpp

示例3: clear_pro

void CreateProcess::clear_pro(void)
{
    while(1)
    {
        for (int i = 0; i < integerVector.size(); ++i)
        {
            if(integerVector.at(i)->waitForFinished())
            {
                integerVector.at(i)->close();
                integerVector.remove(i);
            }
            if(integerVector.isEmpty())
            {
                qDebug() << "耗时:" << Timer.elapsed() << "ms";
                qDebug()<< "总文件个数:"<<filenum;
                qDebug()<< "总文件写数据大小:"<<sum<<"kB";
                qDebug()<< "总文件写速度:"<<sum/(Timer.elapsed()/1000.00) <<"kBps";
                qDebug()<< "每个进程写文件速度:"<<sum/(Timer.elapsed()/1000.00)/processNum <<"kBps";
                qDebug()<< "每秒写文件个数:"<< filenum/(Timer.elapsed()/1000.0) <<"个/s";
                qDebug()<< "每个进程写文件个数:"<< filenum/(Timer.elapsed()/1000.0)/processNum <<"个/s";
                break;
            }
        }
    }
}
开发者ID:janhw,项目名称:TestFilesystem,代码行数:25,代码来源:main.cpp

示例4: QScriptValue

static QScriptValue scriptVGE2RemoveEdge(QScriptContext *context, QScriptEngine *)
{
    if(context->argumentCount() != 1 || !context->argument(0).isObject())
    {
        context->throwError("removeEdge - invalid parameters");
        return QScriptValue();
    }

    grEdge edge;
    fromScriptValue_grEdge(context->argument(0), edge);

    if((edge.iFrom < 0 || edge.iFrom >= qvGraphVertices.size()) ||
       (edge.iTo < 0 || edge.iTo >= qvGraphVertices.size()) ||
       (edge.iFrom == edge.iTo))
    {
        context->throwError("removeEdge - invalid parameters");
        return QScriptValue();
    }

    for(int i = 0; i < qvGraphEdges.size(); i++)
    {
        if(qvGraphEdges[i].iFrom == edge.iFrom && qvGraphEdges[i].iTo == edge.iTo)
        {
            qvGraphEdges.remove(i, 1);
            globalStackIsModified++;
            needToRebuildRD = true;

            return QScriptValue();
        }
    }

    context->throwError("removeEdge - invalid parameters");
    return QScriptValue();
}
开发者ID:Ekventor,项目名称:vge2,代码行数:34,代码来源:scriptmanager.cpp

示例5: setDNA

void Vehicle::setDNA(QVector<double> &dna)
{
    // Пересчитывается количество колёс, чтобы не привысить максимальное.
    QVector <int> vehWheels;

    vectors.resize(pointsNum);
    // Восстановление машин из ДНК
    for(int i = 0; i < pointsNum; ++i)
    {
        vectors[i].angle = dna[i * 8];
        vectors[i].length = dna[i * 8 + 1];
        vectors[i].r = dna[i * 8 + 2];
        vectors[i].g = dna[i * 8 + 3];
        vectors[i].b = dna[i * 8 + 4];
        vectors[i].wheel = dna[i * 8 + 5];
        vectors[i].radius = dna[i * 8 + 6];
        vectors[i].motorSpeed = dna[i * 8 + 7];

        // Подсчёт количетсва колёс у каждого автомобиля
        if(vectors[i].wheel)
        {
            vehWheels.push_back(i);
        }
    }

    // Удаление лишних колёс
    while((vehWheels.size() > maxWheelsNum) && (vehWheels.size() > 0))
    {
        int currentRemoved = rand() % vehWheels.size();
        vectors[vehWheels[currentRemoved]].wheel = false;
        vehWheels.remove(currentRemoved, 1);
    }

    wheelsNum = vehWheels.size();
}
开发者ID:GeneticAlgorithmsConference,项目名称:Cars,代码行数:35,代码来源:vehicle.cpp

示例6: pixmap

QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
{
    QPixmap pm;
    QPixmapIconEngineEntry *pe = bestMatch(size, mode, state, false);
    if (pe)
        pm = pe->pixmap;

    if (pm.isNull()) {
        int idx = pixmaps.count();
        while (--idx >= 0) {
            if (pe == &pixmaps[idx]) {
                pixmaps.remove(idx);
                break;
            }
        }
        if (pixmaps.isEmpty())
            return pm;
        else
            return pixmap(size, mode, state);
    }

    QSize actualSize = pm.size();
    if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height()))
        actualSize.scale(size, Qt::KeepAspectRatio);

    QString key = QLatin1String("$qt_icon_")
                  + QString::number(pm.cacheKey())
                  + QString::number(pe->mode)
                  + QString::number(actualSize.width())
                  + QLatin1Char('_')
                  + QString::number(actualSize.height())
                  + QLatin1Char('_');


    if (mode == QIcon::Active) {
        if (QPixmapCache::find(key + QString::number(mode), pm))
            return pm; // horray
        if (QPixmapCache::find(key + QString::number(QIcon::Normal), pm)) {
            QStyleOption opt(0);
            opt.palette = QApplication::palette();
            QPixmap active = QApplication::style()->generatedIconPixmap(QIcon::Active, pm, &opt);
            if (pm.cacheKey() == active.cacheKey())
                return pm;
        }
    }

    if (!QPixmapCache::find(key + QString::number(mode), pm)) {
        if (pm.size() != actualSize)
            pm = pm.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
        if (pe->mode != mode && mode != QIcon::Normal) {
            QStyleOption opt(0);
            opt.palette = QApplication::palette();
            QPixmap generated = QApplication::style()->generatedIconPixmap(mode, pm, &opt);
            if (!generated.isNull())
                pm = generated;
        }
        QPixmapCache::insert(key + QString::number(mode), pm);
    }
    return pm;
}
开发者ID:Fale,项目名称:qtmoko,代码行数:60,代码来源:qicon.cpp

示例7: peerRemoveChan

int ToxTunBase::peerRemoveChan(ENetPeer *enpeer, ToxTunChannel *chan)
{
    ToxTunChannel *tchan0 = (ToxTunChannel*)enpeer->ENET_PEER_TOXCHAN;
    assert(tchan0 == chan);
    enpeer->ENET_PEER_TOXCHAN = NULL;
    return 0;
    //
    QVector<ToxTunChannel*>* chans = (QVector<ToxTunChannel*>*)enpeer->ENET_PEER_TOXCHAN;
    int idx = -1;
    ToxTunChannel *tchan = NULL;
    
    for (int i = 0; i < chans->count(); i++) {
        tchan = chans->at(i);
        if (tchan == chan) {
            idx = i;
            break;
        }
    }

    if (idx ==  -1) {
        qDebug()<<"chan not found:"<<chan<<chan->m_conid;
        return idx;
    }

    chans->remove(idx);
    
    return idx;
}
开发者ID:kitech,项目名称:toxsh,代码行数:28,代码来源:toxtunbase.cpp

示例8: closeEvent

void MemoryEditor::closeEvent(QCloseEvent*) {
  int32_t index = memoryEditors.indexOf(this);

  if (index >= 0) {
    memoryEditors.remove(index);
  }
}
开发者ID:Optiroc,项目名称:bsnes-plus,代码行数:7,代码来源:memory.cpp

示例9: removeFromArray

//! Removes elements of the specified type from an array
template <typename T> static void removeFromArray( QVector<T> & array, QMap<quint16, bool> map )
{
	for ( int x = array.count() - 1; x >= 0; x-- )
	{
		if ( ! map.contains( x ) )
			array.remove( x );
	}
}
开发者ID:Alphax,项目名称:nifskope,代码行数:9,代码来源:mesh.cpp

示例10: removeFromVector

void removeFromVector(QVector<T>& vec, const T& t) {
  for(int a  =0; a < vec.size(); ++a) {
    if(vec[a] == t) {
      vec.remove(a);
      removeFromVector(vec, t);
      return;
    }
  }
}
开发者ID:KDE,项目名称:kdevplatform,代码行数:9,代码来源:topducontext.cpp

示例11: unique

void OsmDatabase::unique( QVector<OsmPlacemark> &placemarks ) const
{
    for ( int i=1; i<placemarks.size(); ++i ) {
        if ( placemarks[i-1] == placemarks[i] ) {
            placemarks.remove( i );
            --i;
        }
    }
}
开发者ID:AsherBond,项目名称:marble,代码行数:9,代码来源:OsmDatabase.cpp

示例12:

void Nuria::Debug::uninstallOutputHandler (const Callback &callback) {
	
	// Remove.
	int idx = g_handlers.indexOf (callback);
	
	if (idx != -1) {
		g_handlers.remove (idx);
	}
	
}
开发者ID:delgor,项目名称:Core,代码行数:10,代码来源:debug.cpp

示例13: remove_cred_modifier

static void remove_cred_modifier(QVector<Maemo::Timed::cred_modifier_io_t> &x, const QString &token, bool accrue)
{
  Maemo::Timed::cred_modifier_io_t lookFor ;
  lookFor.token = token ;
  lookFor.accrue = accrue ;
  for(int i = x.indexOf(lookFor); i != -1; i = x.indexOf(lookFor))
  {
    x.remove(i) ;
  }
}
开发者ID:deztructor,项目名称:timed,代码行数:10,代码来源:event-pimple.cpp

示例14: getDiff

QVector<int> getDiff(QVector<int> V1, QVector<int> V2)
{
    QVector<int> result = V1;
    int pos;
    for(int i=0; i<V2.count(); i++)
    {
        pos = result.indexOf(V2.at(i));
        if(pos != -1) result.remove(pos, 1);
    }
    return result;
}
开发者ID:ga57toy,项目名称:libFactorGraph,代码行数:11,代码来源:utils.cpp

示例15: removeRows

bool QtTestModel::removeRows( int row, int count, const QModelIndex & parent)
{
    QAbstractItemModel::beginRemoveRows(parent, row, row + count - 1);

    for (int r = row+count-1; r >= row; --r)
        table.remove(r);
    rCount = table.count();

    QAbstractItemModel::endRemoveRows();
    return true;
}
开发者ID:,项目名称:,代码行数:11,代码来源:


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