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


C++ QList::removeOne方法代码示例

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


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

示例1: getPrimeNumber

QList<int> ValueModelBase::getCompositeNumber(QList<int> in)
{
	QList<int> prime = getPrimeNumber(in);
	QList<int> composite = in;
	for (auto& obj: composite)
	{
		if (prime.contains(obj))
		{
			composite.removeOne(obj);
			
		}
	}

	return composite;
}
开发者ID:richardlee8681,项目名称:CaiPiao,代码行数:15,代码来源:ValueModelBase.cpp

示例2:

QList<core::GraphicObject *> core::Connector::removeIgnoredObjects(const QList<GraphicObject *> &list) const
{
	GraphicObject *obj;
	QList<GraphicObject*> returnedList = list;

	for(auto i = 0; i < returnedList.size(); i++){
		obj = returnedList[i];

		if(obj->type() == gotConnector || obj == beginObject){
			returnedList.removeOne(obj);
			i--;
		}
	}

	return returnedList;
}
开发者ID:VARPERTecnology,项目名称:INSYDE,代码行数:16,代码来源:connector.cpp

示例3: updateTrackMetadata

void Library::updateTrackMetadata(Track track) {
	Track ntrack = track;
	if (track.id() > 0) {
		ntrack = _library_storage->updateTrack(track);
	}
	// update all playlists
	QList<QString> playlists = getPlaylistsNames();
	foreach (QString name, playlists) {
		Playlist pl = getPlaylist(name);
		QList<Track> tracks = pl.tracks();
		int pos = tracks.indexOf(ntrack); // comparing using source
		tracks.removeOne(ntrack); // comparing using source
		tracks.insert(pos, ntrack);
		pl.setTracks(tracks);
		savePlaylist(pl);
	}
开发者ID:sumankumar,项目名称:someplayer,代码行数:16,代码来源:library.cpp

示例4: getHighestAndRemove

short TankBuilder::getHighestAndRemove(QList<short> &aNumberList)
{
    short highestValue = -1;

    if (!aNumberList.isEmpty())
    {
        foreach(short number, aNumberList)
        {
            if (number > highestValue)
            {
                highestValue = number;
            }
        }

        aNumberList.removeOne(highestValue);
    }
开发者ID:TeamQuadForce,项目名称:Comp345RPG,代码行数:16,代码来源:tankbuilder.cpp

示例5: checkTiles

void Test::checkTiles( int boardSize, vector< int >& squares )
{
    QList< int > values;

    for ( int i = 0; i < boardSize * boardSize; i++ )
    {
        values.append( i );
    }

    for ( int i = 0; i < boardSize * boardSize; i++ )
    {
        QCOMPARE( values.contains( squares[i] ), true );
        values.removeOne( squares[i] );
    }

    QCOMPARE( values.size(), 0 );
}
开发者ID:Przemyslawmd,项目名称:Fifteen,代码行数:17,代码来源:Test.cpp

示例6: AddRecentFile

void PersistantConfig::AddRecentFile(QList<QString> &recentList, const QString &file, int maxItems)
{
  QDir dir(file);
  QString path = dir.canonicalPath();

  if(!recentList.contains(path))
  {
    recentList.push_back(path);
    if(recentList.count() >= maxItems)
      recentList.removeAt(0);
  }
  else
  {
    recentList.removeOne(path);
    recentList.push_back(path);
  }
}
开发者ID:michaelkvance,项目名称:renderdoc,代码行数:17,代码来源:PersistantConfig.cpp

示例7: closeAllOther

void DocumentManager::closeAllOther( AbstractDocument* keptDocument )
{
    // TODO: is it better for remove the document from the list before emitting closing(document)?
    // TODO: or better emit close(documentList)? who would use this?
    QList<AbstractDocument*> closedDocuments = mList;
    closedDocuments.removeOne( keptDocument );

    mList.clear();
    mList.append( keptDocument );

    emit closing( closedDocuments );

    foreach( AbstractDocument* document, closedDocuments )
    {
        delete document;
    }
}
开发者ID:KDE,项目名称:okteta,代码行数:17,代码来源:documentmanager.cpp

示例8: compressImports

void RewriteActionCompressor::compressImports(QList<RewriteAction *> &actions) const
{
    QList<RewriteAction *> actionsToRemove;
    QHash<Import, RewriteAction *> addedImports;
    QHash<Import, RewriteAction *> removedImports;

    QMutableListIterator<RewriteAction *> iter(actions);
    iter.toBack();
    while (iter.hasPrevious()) {
        RewriteAction *action = iter.previous();

        if (RemoveImportRewriteAction *removeImportAction = action->asRemoveImportRewriteAction()) {
            const Import import = removeImportAction->import();
            if (removedImports.contains(import)) {
                actionsToRemove.append(action);
            } else if (RewriteAction *addImportAction = addedImports.value(import, 0)) {
                actionsToRemove.append(action);
                actionsToRemove.append(addImportAction);
                addedImports.remove(import);
                delete addImportAction;
            } else {
                removedImports.insert(import, action);
            }
        } else if (AddImportRewriteAction *addImportAction = action->asAddImportRewriteAction()) {
            const Import import = addImportAction->import();
            if (RewriteAction *duplicateAction = addedImports.value(import, 0)) {
                actionsToRemove.append(duplicateAction);
                addedImports.remove(import);
                delete duplicateAction;
                addedImports.insert(import, action);
            } else if (RewriteAction *removeAction = removedImports.value(import, 0)) {
                actionsToRemove.append(action);
                actionsToRemove.append(removeAction);
                removedImports.remove(import);
                delete removeAction;
            } else {
                addedImports.insert(import, action);
            }
        }
    }

    foreach (RewriteAction *action, actionsToRemove) {
        actions.removeOne(action);
        delete action;
    }
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:45,代码来源:rewriteactioncompressor.cpp

示例9: QCOMPARE

void TestKeePass2Format::testXmlEntry2()
{
    const Entry* entry = m_xmlDb->rootGroup()->entries().at(1);

    QCOMPARE(entry->uuid(), QUuid::fromRfc4122(QByteArray::fromBase64("4jbADG37hkiLh2O0qUdaOQ==")));
    QCOMPARE(entry->iconNumber(), 0);
    QCOMPARE(entry->iconUuid(), QUuid::fromRfc4122(QByteArray::fromBase64("++vyI+daLk6omox4a6kQGA==")));
    // TODO: test entry->icon()
    QCOMPARE(entry->foregroundColor(), QColor(255, 0, 0));
    QCOMPARE(entry->backgroundColor(), QColor(255, 255, 0));
    QCOMPARE(entry->overrideUrl(), QString("http://override.net/"));
    QCOMPARE(entry->tags(), QString(""));

    const TimeInfo ti = entry->timeInfo();
    QCOMPARE(ti.usageCount(), 7);

    QList<QString> attrs = entry->attributes()->keys();
    QCOMPARE(entry->attributes()->value("CustomString"), QString("isavalue"));
    QVERIFY(attrs.removeOne("CustomString"));
    QCOMPARE(entry->attributes()->value("Notes"), QString(""));
    QVERIFY(attrs.removeOne("Notes"));
    QCOMPARE(entry->attributes()->value("Password"), QString("Jer60Hz8o9XHvxBGcRqT"));
    QVERIFY(attrs.removeOne("Password"));
    QCOMPARE(entry->attributes()->value("Protected String"), QString("y")); // TODO: should have a protection attribute
    QVERIFY(attrs.removeOne("Protected String"));
    QCOMPARE(entry->attributes()->value("Title"), QString("Sample Entry 2"));
    QVERIFY(attrs.removeOne("Title"));
    QCOMPARE(entry->attributes()->value("URL"), QString("http://www.keepassx.org/"));
    QVERIFY(attrs.removeOne("URL"));
    QCOMPARE(entry->attributes()->value("UserName"), QString("notDEFUSERNAME"));
    QVERIFY(attrs.removeOne("UserName"));
    QVERIFY(attrs.isEmpty());

    QCOMPARE(entry->attachments()->keys().size(), 1);
    QCOMPARE(QString::fromLatin1(entry->attachments()->value("myattach.txt")), QString("abcdefghijk"));

    QCOMPARE(entry->autoTypeEnabled(), true);
    QCOMPARE(entry->autoTypeObfuscation(), 1);
    QCOMPARE(entry->defaultAutoTypeSequence(), QString("{USERNAME}{TAB}{PASSWORD}{ENTER}"));
    QCOMPARE(entry->autoTypeAssociations()->size(), 2);
    const AutoTypeAssociations::Association assoc1 = entry->autoTypeAssociations()->get(0);
    QCOMPARE(assoc1.window, QString("Target Window"));
    QCOMPARE(assoc1.sequence, QString("{Title}{UserName}"));
    const AutoTypeAssociations::Association assoc2 = entry->autoTypeAssociations()->get(1);
    QCOMPARE(assoc2.window, QString("Target Window 2"));
    QCOMPARE(assoc2.sequence, QString("{Title}{UserName} test"));
}
开发者ID:droidmonkey,项目名称:keepassx_http,代码行数:47,代码来源:TestKeePass2Format.cpp

示例10: trigger

    virtual bool trigger(TriggerEvent event, ServerPlayer *player, QVariant &data) const{
        Room *room = player->getRoom();
        QList<const Card *> clubs;

        if(event == CardUsed){
            CardUseStruct use = data.value<CardUseStruct>();
            const SkillCard *skill_card = qobject_cast<const SkillCard *>(use.card);
            if(skill_card && skill_card->subcardsLength() > 0 && skill_card->willThrow()){
                clubs = getClubs(skill_card);
            }
        }else if(event == CardDiscarded){
            const Card *card = data.value<CardStar>();
            if(card->subcardsLength() == 0)
                return false;

            clubs = getClubs(card);
        }else if(event == FinishJudge){
            JudgeStar judge = data.value<JudgeStar>();
            if(room->getCardPlace(judge->card->getEffectiveId()) == Player::DiscardedPile
               && judge->card->getSuit() == Card::Club)
               clubs << judge->card;
        }

        ServerPlayer *caozhi = room->findPlayerBySkillName(objectName());
        foreach(const Card* card, clubs)
            if(card->objectName() == "shit")
                if(caozhi && room->askForChoice(caozhi, objectName(), "yes+no") == "no")
                    clubs.removeOne(card);

        if(clubs.isEmpty())
            return false;

        if(caozhi && caozhi->askForSkillInvoke(objectName(), data)){
            if(player->getGeneralName() == "zhenji")
                room->playSkillEffect("luoying", 2);
            else
                room->playSkillEffect("luoying", 1);

            foreach(const Card *club, clubs)
                caozhi->obtainCard(club);
        }

        return false;
    }
开发者ID:,项目名称:,代码行数:44,代码来源:

示例11: while

QList<QByteArray> SkyNet::filter_existing_chans(QList<QByteArray> peer_ids)
{
    QList<QByteArray> ret = peer_ids;

    if (!nodelink)
      return ret;

    struct PICA_chaninfo *iptr = nodelink->chan_list_head;

    while(iptr)
        {
        if (peer_ids.contains(QByteArray((const char*)iptr->peer_id, PICA_ID_SIZE)))
            ret.removeOne((const char*)iptr->peer_id);

        iptr = iptr->next;
        }

    return ret;
}
开发者ID:NePank,项目名称:pica-pica,代码行数:19,代码来源:skynet.cpp

示例12: removeCookie

void CookieManager::removeCookie()
{
    QTreeWidgetItem* current = ui->cookieTree->currentItem();
    if (!current) {
        return;
    }

    QList<QNetworkCookie> allCookies = mApp->cookieJar()->getAllCookies();

    if (current->text(1).isEmpty()) {     //Remove whole cookie group
        QString domain = current->whatsThis(0);
        foreach(const QNetworkCookie & cookie, allCookies) {
            if (cookie.domain() == domain || cookie.domain()  ==  domain.mid(1)) {
                allCookies.removeOne(cookie);
            }
        }

        ui->cookieTree->deleteItem(current);
    }
开发者ID:JoseAngelMuyoz,项目名称:QupZilla,代码行数:19,代码来源:cookiemanager.cpp

示例13: load

void ToolBars::load(const QJsonArray & bars) {
    if (bars.count() > 0) {
        QList<QString> barsList;
        barsList
            << TOOLBAR_MEDIA_KEY
            << TOOLBAR_MEDIA_PLUS_KEY
            << TOOLBAR_MEDIA_POS_KEY
            << TOOLBAR_MEDIA_PAN_KEY
            << TOOLBAR_MEDIA_TEMPO_KEY
            << TOOLBAR_SEARCH_KEY
            << TOOLBAR_MEDIA_TIME_KEY
            << TOOLBAR_MEDIA_VOLUME_KEY
            << TOOLBAR_PL_ITEM_FEATURES_KEY
            << TOOLBAR_SL_ITEM_FEATURES_KEY
            << TOOLBAR_CONTROLS_KEY
            << TOOLBAR_SETTINGS_KEY
            << TOOLBAR_SPECTRUM_KEY
            << TOOLBAR_EQUALIZER_KEY
            << TOOLBAR_EQUALIZER_BUTTON_KEY;

        QJsonObject obj, actionObj;
        QString barName;
        QToolBar * curr_bar;

        for(QJsonArray::ConstIterator bar = bars.constBegin(); bar != bars.constEnd(); bar++) {
            obj = (*bar).toObject();
            barName = obj.value(Keys::title).toString();
            barsList.removeOne(barName);
            curr_bar = linkNameToToolbar(barName);
            curr_bar -> setObjectName(obj.value(Keys::name).toString(curr_bar -> objectName()));
            curr_bar -> setMovable(obj.value(Keys::movable).toBool());

            container -> addToolBar(Qt::BottomToolBarArea, curr_bar);

            if (obj.contains(Keys::actions)) {
                QJsonArray actions = obj.value(Keys::actions).toArray();

                foreach(QJsonValue act, actions) { // rewrite on for
                    actionObj = act.toObject();
                    addPanelButton(actionObj.value(Keys::name).toString(), actionObj.value(Keys::path).toString(), curr_bar);
                }
            }
开发者ID:jeyboy,项目名称:playo3,代码行数:42,代码来源:toolbars.cpp

示例14: main

int main(int argc, char *argv[])
{
	QCoreApplication a(argc, argv);

	QList<int> list;

	for (unsigned int i = 0; i < 10; i++)
	{
		list.append(i);
	}

	list.removeOne(5);

	foreach (int mNumber, list)
	{
		qDebug() << mNumber;
	}

	return a.exec();
}
开发者ID:ggurbet,项目名称:qtexamples,代码行数:20,代码来源:main.cpp

示例15: convertCategoriesToDeclarative

void QDeclarativeLandmarkCategoryModel::convertCategoriesToDeclarative()
{
    QList<QString> categoriesToRemove = m_categoryMap.keys();

    foreach(const QLandmarkCategory& category, m_categories) {
        if (!m_categoryMap.contains(category.categoryId().localId())) {
            QDeclarativeLandmarkCategory* declarativeLandmarkCategory = new QDeclarativeLandmarkCategory(this);
            declarativeLandmarkCategory->setCategory(category);
            m_categoryMap.insert(category.categoryId().localId(), declarativeLandmarkCategory);
        } else {
            // The landmark exists already, update it
            m_categoryMap.value(category.categoryId().localId())->setCategory(category);
            // Item is still valid, remove it from the list of removables
            categoriesToRemove.removeOne(category.categoryId().localId());
        }
    }
    foreach (const QString removable, categoriesToRemove) {
        delete m_categoryMap.value(removable);
        m_categoryMap.remove(removable);
    }
开发者ID:,项目名称:,代码行数:20,代码来源:


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