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


C++ QSet::isEmpty方法代码示例

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


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

示例1: updateTileRequests

void QGeoTiledMappingManagerEngine::updateTileRequests(QGeoTiledMapData *map,
        const QSet<QGeoTileSpec> &tilesAdded,
        const QSet<QGeoTileSpec> &tilesRemoved)
{
    Q_D(QGeoTiledMappingManagerEngine);

    typedef QSet<QGeoTileSpec>::const_iterator tile_iter;

    // add and remove tiles from tileset for this map

    QSet<QGeoTileSpec> oldTiles = d->mapHash_.value(map);

    tile_iter rem = tilesRemoved.constBegin();
    tile_iter remEnd = tilesRemoved.constEnd();
    for (; rem != remEnd; ++rem) {
        oldTiles.remove(*rem);
    }

    tile_iter add = tilesAdded.constBegin();
    tile_iter addEnd = tilesAdded.constEnd();
    for (; add != addEnd; ++add) {
        oldTiles.insert(*add);
    }

    d->mapHash_.insert(map, oldTiles);

    // add and remove map from mapset for the tiles

    QSet<QGeoTileSpec> reqTiles;
    QSet<QGeoTileSpec> cancelTiles;

    rem = tilesRemoved.constBegin();
    for (; rem != remEnd; ++rem) {
        QSet<QGeoTiledMapData *> mapSet = d->tileHash_.value(*rem);
        mapSet.remove(map);
        if (mapSet.isEmpty()) {
            cancelTiles.insert(*rem);
            d->tileHash_.remove(*rem);
        } else {
            d->tileHash_.insert(*rem, mapSet);
        }
    }

    add = tilesAdded.constBegin();
    for (; add != addEnd; ++add) {
        QSet<QGeoTiledMapData *> mapSet = d->tileHash_.value(*add);
        if (mapSet.isEmpty()) {
            reqTiles.insert(*add);
        }
        mapSet.insert(map);
        d->tileHash_.insert(*add, mapSet);
    }

    cancelTiles -= reqTiles;

    QMetaObject::invokeMethod(d->fetcher_, "updateTileRequests",
                              Qt::QueuedConnection,
                              Q_ARG(QSet<QGeoTileSpec>, reqTiles),
                              Q_ARG(QSet<QGeoTileSpec>, cancelTiles));
}
开发者ID:krysanto,项目名称:steamlink-sdk,代码行数:60,代码来源:qgeotiledmappingmanagerengine.cpp

示例2: RemoveItems

	void ItemsListModel::RemoveItems (QSet<IDType_t> ids)
	{
		if (ids.isEmpty ())
			return;

		const bool shouldReset = ids.size () > 10;

		for (auto i = CurrentItems_.begin ();
				i != CurrentItems_.end () && !ids.isEmpty (); )
		{
			if (!ids.contains (i->ItemID_))
			{
				++i;
				continue;
			}

			ids.remove (i->ItemID_);
			if (!shouldReset)
			{
				const size_t dist = std::distance (CurrentItems_.begin (), i);
				beginRemoveRows (QModelIndex (), dist, dist);
			}
			i = CurrentItems_.erase (i);
			if (!shouldReset)
			{
				endRemoveRows ();
				qApp->processEvents (QEventLoop::ExcludeUserInputEvents);
			}
		}

		if (shouldReset)
			reset ();
	}
开发者ID:ttldtor,项目名称:leechcraft,代码行数:33,代码来源:itemslistmodel.cpp

示例3:

QList<QSharedPointer<QGeoTileTexture> > QGeoTileRequestManagerPrivate::requestTiles(const QSet<QGeoTileSpec> &tiles)
{
    QSet<QGeoTileSpec> cancelTiles = requested_ - tiles;
    QSet<QGeoTileSpec> requestTiles = tiles - requested_;
    QSet<QGeoTileSpec> cached;
//    int tileSize = tiles.size();
//    int newTiles = requestTiles.size();

    typedef QSet<QGeoTileSpec>::const_iterator iter;

    QList<QSharedPointer<QGeoTileTexture> > cachedTex;

    QGeoTiledMappingManagerEngine *engine = map_ ?
                static_cast<QGeoTiledMappingManagerEngine *>(map_->engine()) : 0;

    // remove tiles in cache from request tiles
    if (engine) {
        iter i = requestTiles.constBegin();
        iter end = requestTiles.constEnd();
        for (; i != end; ++i) {
            QGeoTileSpec tile = *i;
            QSharedPointer<QGeoTileTexture> tex = engine->getTileTexture(tile);
            if (tex) {
                cachedTex << tex;
                cached.insert(tile);
            }
        }
    }

    requestTiles -= cached;

    requested_ -= cancelTiles;
    requested_ += requestTiles;

//    qDebug() << "required # tiles: " << tileSize << ", new tiles: " << newTiles << ", total server requests: " << requested_.size();

    if (!requestTiles.isEmpty() || !cancelTiles.isEmpty()) {
        if (engine) {
//            qDebug() << "new server requests: " << requestTiles.size() << ", server cancels: " << cancelTiles.size();
            engine->updateTileRequests(map_, requestTiles, cancelTiles);

            // Remove any cancelled tiles from the error retry hash to avoid
            // re-using the numbers for a totally different request cycle.
            iter i = cancelTiles.constBegin();
            iter end = cancelTiles.constEnd();
            for (; i != end; ++i) {
                retries_.remove(*i);
                futures_.remove(*i);
            }
        }
    }

    return cachedTex;
}
开发者ID:agunnarsson,项目名称:qtlocation,代码行数:54,代码来源:qgeotilerequestmanager.cpp

示例4: engineTileFinished

void QGeoTiledMappingManagerEngine::engineTileFinished(const QGeoTileSpec &spec, const QByteArray &bytes, const QString &format)
{
    Q_D(QGeoTiledMappingManagerEngine);

    QSet<QGeoTiledMapData *> maps = d->tileHash_.value(spec);

    typedef QSet<QGeoTiledMapData *>::const_iterator map_iter;

    map_iter map = maps.constBegin();
    map_iter mapEnd = maps.constEnd();
    for (; map != mapEnd; ++map) {
        QSet<QGeoTileSpec> tileSet = d->mapHash_.value(*map);
        tileSet.remove(spec);
        if (tileSet.isEmpty())
            d->mapHash_.remove(*map);
        else
            d->mapHash_.insert(*map, tileSet);
    }

    d->tileHash_.remove(spec);

    tileCache()->insert(spec, bytes, format, d->cacheHint_);

    map = maps.constBegin();
    mapEnd = maps.constEnd();
    for (; map != mapEnd; ++map) {
        (*map)->getRequestManager()->tileFetched(spec);
    }
}
开发者ID:krysanto,项目名称:steamlink-sdk,代码行数:29,代码来源:qgeotiledmappingmanagerengine.cpp

示例5: SelectFavoriteChannels

//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
// Activate the Select From Favorites popup
void tSiriusController::SelectFavoriteChannels()
{
    bool hasList = RefreshFavoriteChannels(tAudioSettings::Instance()->Favorites());    //if returns false that means we have no subscriptions yet, we're still powering up

    if (hasList == true)
    {
        Assert( m_pFavoriteChannels != 0 );

        QSet<int> favoriteSet = QSet<int>::fromList(*m_pFavoriteChannels);

        if (favoriteSet.isEmpty())
        {
            tMessageBox::Error( 0, tr( "Favorites"), tr("No favorites defined"), tMessageBox::CLOSE );

            return;
        }

        const QList<tChannelRecord *>& chanList = GetSubscribedSubsetList(favoriteSet);

        SelectFromChannels(chanList, tr("Channels") + QString(" - ") + tr("Favorites"), false);    //no favorites column needed for the favorites list (all we'd be able to do is unfavorite them, not sure that is entirely useful?)
    }
    else
    {
        tMessageBox::Error( 0, tr( "Favorites"), tr("Still powering up, please try again."), tMessageBox::CLOSE );
    }
}
开发者ID:dulton,项目名称:53_hero,代码行数:30,代码来源:tSiriusController.cpp

示例6: isKnownSymbol

bool TestConfigParser::isKnownSymbol(const QString &symbol)
{
    if (knownSymbols.isEmpty()) {
        knownSymbols
            // If you add a symbol here, add a case for it in
            // isDefined() as well.
            << "Q_OS_LINUX"
            << "Q_OS_SOLARIS"
            << "Q_OS_WINCE"
            << "Q_OS_SYMBIAN"
            << "Q_OS_MAC"
            << "Q_OS_WIN"
            << "Q_CC_MSVC"
            << "Q_CC_MSVC32"
            << "Q_CC_MSVC64"
            << "Q_CC_MINGW"
            << "Q_CC_MINGW32"
            << "Q_CC_MINGW64"
            << "Q_CC_INTEL"
            << "Q_CC_INTEL32"
            << "Q_CC_INTEL64"
            ;
    }
    return knownSymbols.contains(symbol);
}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:25,代码来源:abstracttestsuite.cpp

示例7: ItemUpdateGroup

int CFrmUserList::ItemUpdateGroup(QSharedPointer<CUserInfo> info)
{
    QSet<QString> groups = info->GetGroups();
    if(groups.isEmpty())
    {
        QString szDefaulGroup(tr("My friends"));
        groups.insert(szDefaulGroup);
    }

    for(QSet<QString>::iterator itGroup = groups.begin(); itGroup != groups.end(); itGroup++)
    {
        QString szGroup = *itGroup;
        QStandardItem* lstGroup = NULL;
        QMap<QString, QStandardItem*>::iterator it;
        it = m_Groups.find(szGroup);
        if(m_Groups.end() == it)
        {
            //新建立组条目 
            lstGroup = ItemInsertGroup(szGroup);
        }
        else
            lstGroup = it.value();

        QList<QStandardItem *> lstItems = NewItemRoster(info);
        if(lstItems.isEmpty())
            continue;
        lstGroup->appendRow(lstItems);
    }

    return 0;
}
开发者ID:s18leoare,项目名称:rabbitim,代码行数:31,代码来源:FrmUserList.cpp

示例8: saveSet

void PlayersListModel::saveSet(const QSet<QString> & set, const QString & suffix)
{
    qDebug("saving set");

    QString fileName = QString("%1/%2_%3.txt").arg(cfgdir->absolutePath(), m_nickname.toLower(), suffix);

    QFile txt(fileName);

    // list empty? => rather have no file for the list than an empty one
    if (set.isEmpty())
    {
        if (txt.exists())
        {
            // try to remove file, if successful we're done here.
            if (txt.remove())
                return;
        }
        else
            // there is no file
            return;
    }

    if(!txt.open(QIODevice::WriteOnly | QIODevice::Truncate))
        return;

    QTextStream stream(&txt);
    stream.setCodec("UTF-8");

    stream << "; this list is used by Hedgewars - do not edit it unless you know what you're doing!" << endl;

    foreach(const QString & nick, set.values())
        stream << nick << endl;

    txt.close();
}
开发者ID:CaF2,项目名称:hw,代码行数:35,代码来源:playerslistmodel.cpp

示例9: lock

QList<ctkServiceReference> ctkServices::get(const QString& clazz, const QString& filter,
                                            ctkPluginPrivate* plugin) const
{
  Q_UNUSED(plugin)

  QMutexLocker lock(&mutex);

  QListIterator<ctkServiceRegistration>* s = 0;
  QList<ctkServiceRegistration> v;
  ctkLDAPExpr ldap;
  if (clazz.isEmpty())
  {
    if (!filter.isEmpty())
    {
      ldap = ctkLDAPExpr(filter);
      QSet<QString> matched = ldap.getMatchedObjectClasses();
      if (!matched.isEmpty())
      {
        v.clear();
        foreach (QString className, matched)
        {
          const QList<ctkServiceRegistration>& cl = classServices[className];
          v += cl;
        }
        if (!v.isEmpty())
        {
          s = new QListIterator<ctkServiceRegistration>(v);
        }
        else
        {
          return QList<ctkServiceReference>();
        }
      }
      else
      {
开发者ID:benoitbleuze,项目名称:CTK,代码行数:35,代码来源:ctkServices.cpp

示例10: acceptsValueImpl

FormGenAcceptResult FormGenRecordComposition::acceptsValueImpl(const QVariant &val) const
{
    if( variantType(val) != QMetaType::QVariantHash )
        return FormGenAcceptResult::reject({}, val);

    QVariantHash hash = val.toHash();
    QStringList valueStringList;
    QSet<QString> processedTags;

    for( const auto &elm : mElements ) {
        auto elementAccepts = elm.element->acceptsValue(hash.value(elm.tag));
        if( ! elementAccepts.acceptable ) {
            QString path = elm.tag;
            if( ! elementAccepts.path.isEmpty() )
                path += QString("/%1").arg(elementAccepts.path);
            return FormGenAcceptResult::reject(path, elementAccepts.value);
        }
        valueStringList.append(FormGenElement::keyStringValuePair(elm.tag, elementAccepts.valueString));
        processedTags.insert(elm.tag);
    }

    QSet<QString> remainingTags = hash.keys().toSet() - processedTags;
    if( ! remainingTags.isEmpty() )
        return FormGenAcceptResult::reject(*remainingTags.cbegin(),
                                           hash.value(*remainingTags.cbegin()));

    return FormGenAcceptResult::accept(val, FormGenElement::objectString(valueStringList));
}
开发者ID:z-s-e,项目名称:FormGenWidgets-Qt,代码行数:28,代码来源:formgencompositionwidgets.cpp

示例11: handleMemberSelection

void CntFavoritesView::handleMemberSelection( QSet<QContactLocalId> aIds )
{
    if ( aIds.isEmpty() )
    {
        showPreviousView();
    }
    else
    {
        QList<QContactRelationship> memberships;
        foreach (QContactLocalId id, aIds) {
            QContactId contactId;
            contactId.setLocalId(id);
            QContactRelationship membership;
            membership.setRelationshipType(QContactRelationship::HasMember);
            membership.setFirst(mContact->id());
            membership.setSecond(contactId);
            memberships.append(membership);
        }
    
        if (!memberships.isEmpty()) {
            getContactManager()->saveRelationships(&memberships, NULL);
        }
    
        CntViewParameters viewParameters;
        viewParameters.insert(EViewId, favoritesMemberView);
        QVariant var;
        var.setValue(*mContact);
        viewParameters.insert(ESelectedGroupContact, var);
        mViewManager->changeView(viewParameters);
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:30,代码来源:cntfavoritesview.cpp

示例12: routeData

bool QXmppServerPrivate::routeData(const QString &to, const QByteArray &data)
{
    // refuse to route packets to empty destination, own domain or sub-domains
    const QString toDomain = QXmppUtils::jidToDomain(to);
    if (to.isEmpty() || to == domain || toDomain.endsWith("." + domain))
        return false;

    if (toDomain == domain) {

        // look for a client connection
        QList<QXmppIncomingClient*> found;
        if (QXmppUtils::jidToResource(to).isEmpty()) {
            foreach (QXmppIncomingClient *conn, incomingClientsByBareJid.value(to))
                found << conn;
        } else {
            QXmppIncomingClient *conn = incomingClientsByJid.value(to);
            if (conn)
                found << conn;
        }

        // send data
        foreach (QXmppStream *conn, found)
            QMetaObject::invokeMethod(conn, "sendData", Q_ARG(QByteArray, data));
        return !found.isEmpty();

    } else if (!serversForServers.isEmpty()) {

        bool check;
        Q_UNUSED(check);

        // look for an outgoing S2S connection
        foreach (QXmppOutgoingServer *conn, outgoingServers) {
            if (conn->remoteDomain() == toDomain) {
                // send or queue data
                QMetaObject::invokeMethod(conn, "queueData", Q_ARG(QByteArray, data));
                return true;
            }
        }

        // if we did not find an outgoing server,
        // we need to establish the S2S connection
        QXmppOutgoingServer *conn = new QXmppOutgoingServer(domain, 0);
        conn->setLocalStreamKey(QXmppUtils::generateStanzaHash().toLatin1());
        conn->moveToThread(q->thread());
        conn->setParent(q);

        check = QObject::connect(conn, SIGNAL(disconnected()),
                                 q, SLOT(_q_outgoingServerDisconnected()));
        Q_UNUSED(check);

        // add stream
        outgoingServers.insert(conn);
        q->setGauge("outgoing-server.count", outgoingServers.size());

        // queue data and connect to remote server
        QMetaObject::invokeMethod(conn, "queueData", Q_ARG(QByteArray, data));
        QMetaObject::invokeMethod(conn, "connectToHost", Q_ARG(QString, toDomain));
        return true;

    } else {
开发者ID:unisontech,项目名称:qxmpp,代码行数:60,代码来源:QXmppServer.cpp

示例13: isDefined

bool TestConfigParser::isDefined(const QString &symbol)
{
    if (definedSymbols.isEmpty()) {
        definedSymbols
#ifdef Q_OS_LINUX
            << "Q_OS_LINUX"
#endif
#ifdef Q_OS_SOLARIS
            << "Q_OS_SOLARIS"
#endif
#ifdef Q_OS_WINCE
            << "Q_OS_WINCE"
#endif
#ifdef Q_OS_SYMBIAN
            << "Q_OS_SYMBIAN"
#endif
#ifdef Q_OS_MAC
            << "Q_OS_MAC"
#endif
#ifdef Q_OS_WIN
            << "Q_OS_WIN"
#endif
#ifdef Q_CC_MSVC
            << "Q_CC_MSVC"
#endif
#ifdef Q_CC_MINGW
            << "Q_CC_MINGW"
#endif
#ifdef Q_CC_INTEL
            << "Q_CC_INTEL"
#endif
            ;
    }
    return definedSymbols.contains(symbol);
}
开发者ID:Blizzard,项目名称:qt4,代码行数:35,代码来源:abstracttestsuite.cpp

示例14: resolveInheritance

void QrsMetamodelLoader::resolveInheritance(QSet<ElementType *> &elements
		, const QHash<QPair<ElementType *, ElementType *>, QString> &overridingProperties)
{
	// Here we should copy properties, labels and so on from parent subtypes to child subtypes.
	// So we should traverse multigraph from starting from parent types, then child ones and so on.
	// The situation is a bit more complex because we may have multiple inheritance, then the child node may be
	// visited only when all parent properties are already visited.
	while (!elements.isEmpty()) {
		for (ElementType *child : elements) {
			// Checking that all parents are already visited.
			bool allParentsAreVisited = true;
			for (const qrgraph::Edge *edge : child->outgoingEdges(ElementType::generalizationLinkType)) {
				ElementType *parent = static_cast<ElementType *>(edge->end());
				if (elements.contains(parent)) {
					allParentsAreVisited = false;
					break;
				}
			}

			if (allParentsAreVisited) {
				elements.remove(child);
				for (const qrgraph::Edge *edge : child->outgoingEdges(ElementType::generalizationLinkType)) {
					ElementType *parent = static_cast<ElementType *>(edge->end());
					inherit(*child, *parent, overridingProperties[qMakePair(child, parent)]);
				}

				break;
			}
		}
	}
}
开发者ID:ZiminGrigory,项目名称:qreal,代码行数:31,代码来源:qrsMetamodelLoader.cpp

示例15: UpdateGroup

int CFrmUserList::UpdateGroup(CRoster* pRoster, QSet<QString> groups)
{
    if(groups.isEmpty())
    {
        QString szDefaulGroup(tr("My friends"));
        groups.insert(szDefaulGroup);
    }

    for(QSet<QString>::iterator itGroup = groups.begin(); itGroup != groups.end(); itGroup++)
    {
        QString szGroup = *itGroup;
        QStandardItem* lstGroup = NULL;
        QMap<QString, QStandardItem*>::iterator it;
        it = m_Groups.find(szGroup);
        if(m_Groups.end() == it)
        {
            //新建立组条目 
            /*lstGroup = new QStandardItem(szGroup);
            lstGroup->setEditable(false);  //禁止双击编辑 
            m_pModel->appendRow(lstGroup);
            m_Groups.insert(szGroup, lstGroup);//*/
            lstGroup = InsertGroup(szGroup);
        }
        else
            lstGroup = it.value();

        lstGroup->appendRow(pRoster->GetItem());
        LOG_MODEL_DEBUG("Roster", "CFrmUserList::UpdateGroup:%s,(%s)",
                qPrintable(pRoster->BareJid()),
                qPrintable(szGroup));
    }

    return 0;
}
开发者ID:anchowee,项目名称:rabbitim,代码行数:34,代码来源:FrmUserList.cpp


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