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


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

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


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

示例1: cancelTileRequests

void QGeoTileFetcher::cancelTileRequests(const QSet<QGeoTileSpec> &tiles)
{
    Q_D(QGeoTileFetcher);

    typedef QSet<QGeoTileSpec>::const_iterator tile_iter;
    tile_iter tile = tiles.constBegin();
    tile_iter end = tiles.constEnd();
    for (; tile != end; ++tile) {
        QGeoTiledMapReply *reply = d->invmap_.value(*tile, 0);
        if (reply) {
            d->invmap_.remove(*tile);
            reply->abort();
            if (reply->isFinished())
                reply->deleteLater();
        }
        d->queue_.removeAll(*tile);
    }
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:18,代码来源:qgeotilefetcher.cpp

示例2: longDayName

QString
QmlRulesModel::getDaysSummaryText(const QSet<int> &days) const {
    // qDebug("QmlRulesModel::getDaysSummaryText(), days size %d", days.size());

    if (days.size() == 7) {
        return "All days";
    }
    if (days.size() == 0) {
        return "No days";
    }
    // If only one day selected, display full name
    if (days.size() == 1) {
        int dayId = *(days.constBegin());
        return QDate::longDayName(dayId + 1, QDate::StandaloneFormat);
    }

    int rangeStart = -1;

    QString daysStr = "";
    // The loop goes up-to 7 so that Sunday is considered as last in range.
    // Days.contains for 7 should always contain false as days are in range of 0-6.
    for (int i = 0; i < 8; ++i) {
        if (days.contains(i)) {
            if (rangeStart < 0) {
                rangeStart = i;

            }
        } else {
            if (rangeStart > -1) {
                if (!daysStr.isEmpty()) {
                    daysStr += ", ";
                }

                daysStr += QDate::shortDayName(rangeStart + 1, QDate::StandaloneFormat);
                if (rangeStart < i - 1) {
                    daysStr += " - ";
                    daysStr += QDate::shortDayName((i - 1) + 1, QDate::StandaloneFormat);
                }
                rangeStart = -1;
            }
        }
    }
    return daysStr;
}
开发者ID:fmayet,项目名称:profilematic,代码行数:44,代码来源:qmlrulesmodel.cpp

示例3: setDisplayAttributes

void QgsComposerAttributeTable::setDisplayAttributes( const QSet<int>& attr, bool refresh )
{
  if ( !mVectorLayer )
  {
    return;
  }

  //rebuild columns list, taking only attributes with index in supplied QSet
  qDeleteAll( mColumns );
  mColumns.clear();

  const QgsFields& fields = mVectorLayer->fields();

  if ( !attr.empty() )
  {
    QSet<int>::const_iterator attIt = attr.constBegin();
    for ( ; attIt != attr.constEnd(); ++attIt )
    {
      int attrIdx = ( *attIt );
      if ( !fields.exists( attrIdx ) )
      {
        continue;
      }
      QString currentAlias = mVectorLayer->attributeDisplayName( attrIdx );
      QgsComposerTableColumn* col = new QgsComposerTableColumn;
      col->setAttribute( fields[attrIdx].name() );
      col->setHeading( currentAlias );
      mColumns.append( col );
    }
  }
  else
  {
    //resetting, so add all attributes to columns
    int idx = 0;
    Q_FOREACH ( const QgsField& field, fields )
    {
      QString currentAlias = mVectorLayer->attributeDisplayName( idx );
      QgsComposerTableColumn* col = new QgsComposerTableColumn;
      col->setAttribute( field.name() );
      col->setHeading( currentAlias );
      mColumns.append( col );
      idx++;
    }
  }
开发者ID:MrBenjaminLeb,项目名称:QGIS,代码行数:44,代码来源:qgscomposerattributetable.cpp

示例4: csf

CommandTransform::CommandTransform(const QSet<int> &selection, ldraw::model *model, Editor::RotationPivot pivot)
	: CommandBase(selection, model)
{
	setText(i18n("Transform"));

	pivot_ = pivot;

	bool center = false;
	if (pivot_ == Editor::PivotCenter)
		center = true;

	CommandSelectionFilter csf(this);
	pivotpoint_ = PivotExtension::queryPivot(model_, center, &csf);

	for (QSet<int>::ConstIterator it = selection.constBegin(); it != selection.constEnd(); ++it) {
		if (model->elements()[*it]->get_type() == ldraw::type_ref)
			oldmatrices_[*it] = CAST_AS_CONST_REF(model->elements()[*it])->get_matrix();
	}
}
开发者ID:rhabacker,项目名称:Konstruktor,代码行数:19,代码来源:commandtransform.cpp

示例5: initialize

void QgsComposerManager::initialize()
{
  QSettings settings;
  QSet<QgsComposer*> composers = QgisApp::instance()->printComposers();
  QSet<QgsComposer*>::const_iterator it = composers.constBegin();
  for ( ; it != composers.constEnd(); ++it )
  {
    QListWidgetItem* item = new QListWidgetItem(( *it )->title(), mComposerListWidget );
    item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable );
    mItemComposerMap.insert( item, *it );
  }
  mComposerListWidget->sortItems();

  mTemplate->addItem( tr( "Empty composer" ) );
  mTemplate->addItem( tr( "Specific" ) );

  mUserTemplatesDir = QgsApplication::qgisSettingsDirPath() + "/composer_templates";
  QMap<QString, QString> userTemplateMap = defaultTemplates( true );
  if ( userTemplateMap.size() > 0 )
  {
    mTemplate->insertSeparator( mTemplate->count() );
    QMap<QString, QString>::const_iterator templateIt = userTemplateMap.constBegin();
    for ( ; templateIt != userTemplateMap.constEnd(); ++templateIt )
    {
      mTemplate->addItem( templateIt.key(), templateIt.value() );
    }
  }

  mDefaultTemplatesDir = QgsApplication::pkgDataPath() + "/composer_templates";
  QMap<QString, QString> defaultTemplateMap = defaultTemplates( false );
  if ( defaultTemplateMap.size() > 0 )
  {
    mTemplate->insertSeparator( mTemplate->count() );
    QMap<QString, QString>::const_iterator templateIt = defaultTemplateMap.constBegin();
    for ( ; templateIt != defaultTemplateMap.constEnd(); ++templateIt )
    {
      mTemplate->addItem( templateIt.key(), templateIt.value() );
    }
  }

  mTemplatePathLineEdit->setText( settings.value( "/UI/ComposerManager/templatePath", QString( "" ) ).toString() );
}
开发者ID:jacklibj,项目名称:readqgis,代码行数:42,代码来源:qgscomposermanager.cpp

示例6: releaseGlyphs

void QSGSharedDistanceFieldGlyphCache::releaseGlyphs(const QSet<glyph_t> &glyphs)
{
#if defined(QSGSHAREDDISTANCEFIELDGLYPHCACHE_DEBUG)
    qDebug("QSGSharedDistanceFieldGlyphCache::releaseGlyphs() called for %s (%d glyphs)",
           m_cacheId.constData(), glyphs.size());
#endif

    m_requestedGlyphs.subtract(glyphs);

    QVector<quint32> glyphsVector;
    glyphsVector.reserve(glyphs.size());

    QSet<glyph_t>::const_iterator glyphsIt;
    for (glyphsIt = glyphs.constBegin(); glyphsIt != glyphs.constEnd(); ++glyphsIt) {
        QHash<glyph_t, void *>::iterator bufferIt = m_bufferForGlyph.find(*glyphsIt);
        if (bufferIt != m_bufferForGlyph.end()) {
            void *buffer = bufferIt.value();
            removeGlyph(*glyphsIt);
            m_bufferForGlyph.erase(bufferIt);
            Q_ASSERT(!m_bufferForGlyph.contains(*glyphsIt));

            if (!m_sharedGraphicsCache->dereferenceBuffer(buffer)) {
#if !defined(QT_NO_DEBUG)
                bufferIt = m_bufferForGlyph.begin();
                while (bufferIt != m_bufferForGlyph.end()) {
                    Q_ASSERT(bufferIt.value() != buffer);
                    ++bufferIt;
                }
#endif
            }
        }

        glyphsVector.append(*glyphsIt);
    }

    m_hasPostedEvents = true;
    QSGMainThreadInvoker *mainThreadInvoker = QSGMainThreadInvoker::instance();
    QCoreApplication::postEvent(mainThreadInvoker, new QSGReleaseItemsEvent(m_sharedGraphicsCache,
                                                                            m_cacheId,
                                                                            glyphsVector,
                                                                            m_isInSceneGraphUpdate));
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:42,代码来源:qsgshareddistancefieldglyphcache.cpp

示例7: CommandBase

CommandTransform::CommandTransform(const ldraw::matrix &premult,
                                   const ldraw::matrix &postmult,
                                   const QSet<int> &selection,
                                   ldraw::model *model,
                                   Editor::RotationPivot pivotMode,
                                   const ldraw::vector &pivot)
    : CommandBase(selection, model)
{
    setText(QObject::tr("Transform"));

    premult_ = premult;
    postmult_ = postmult;
    pivotMode_ = pivotMode;
    pivot_ = pivot;

    for (QSet<int>::ConstIterator it = selection.constBegin(); it != selection.constEnd(); ++it) {
        if (model->elements()[*it]->get_type() == ldraw::type_ref)
            oldmatrices_[*it] = CAST_AS_CONST_REF(model->elements()[*it])->get_matrix();
    }
}
开发者ID:kartoffelviking,项目名称:Konstruktor,代码行数:20,代码来源:commandtransform.cpp

示例8:

QList<QgsLayoutDesignerInterface *> QgisAppInterface::openLayoutDesigners()
{
  QList<QgsLayoutDesignerInterface *> designerInterfaceList;
  if ( qgis )
  {
    const QSet<QgsLayoutDesignerDialog *> designerList = qgis->layoutDesigners();
    QSet<QgsLayoutDesignerDialog *>::const_iterator it = designerList.constBegin();
    for ( ; it != designerList.constEnd(); ++it )
    {
      if ( *it )
      {
        QgsLayoutDesignerInterface *v = ( *it )->iface();
        if ( v )
        {
          designerInterfaceList << v;
        }
      }
    }
  }
  return designerInterfaceList;
}
开发者ID:tcoupin,项目名称:QGIS,代码行数:21,代码来源:qgisappinterface.cpp

示例9:

QList<QgsComposerView*> QgisAppInterface::activeComposers()
{
  QList<QgsComposerView*> composerViewList;
  if ( qgis )
  {
    const QSet<QgsComposer*> composerList = qgis->printComposers();
    QSet<QgsComposer*>::const_iterator it = composerList.constBegin();
    for ( ; it != composerList.constEnd(); ++it )
    {
      if ( *it )
      {
        QgsComposerView* v = ( *it )->view();
        if ( v )
        {
          composerViewList.push_back( v );
        }
      }
    }
  }
  return composerViewList;
}
开发者ID:Hardysong,项目名称:Quantum-GIS,代码行数:21,代码来源:qgisappinterface.cpp

示例10:

QList<QgsComposerInterface *> QgisAppInterface::openComposers()
{
  QList<QgsComposerInterface *> composerInterfaceList;
  if ( qgis )
  {
    const QSet<QgsComposer *> composerList = qgis->printComposers();
    QSet<QgsComposer *>::const_iterator it = composerList.constBegin();
    for ( ; it != composerList.constEnd(); ++it )
    {
      if ( *it )
      {
        QgsComposerInterface *v = ( *it )->iface();
        if ( v )
        {
          composerInterfaceList << v;
        }
      }
    }
  }
  return composerInterfaceList;
}
开发者ID:exlimit,项目名称:QGIS,代码行数:21,代码来源:qgisappinterface.cpp

示例11: resolveCollisions

void PhysicsSimulation::resolveCollisions() {
    PerformanceTimer perfTimer("resolve");
    // walk all collisions, accumulate movement on shapes, and build a list of affected shapes
    QSet<Shape*> shapes;
    int numCollisions = _collisions.size();
    for (int i = 0; i < numCollisions; ++i) {
        CollisionInfo* collision = _collisions.getCollision(i);
        collision->apply();
        // there is always a shapeA
        shapes.insert(collision->getShapeA());
        // but need to check for valid shapeB
        if (collision->_shapeB) {
            shapes.insert(collision->getShapeB());
        }
    }
    // walk all affected shapes and apply accumulated movement
    QSet<Shape*>::const_iterator shapeItr = shapes.constBegin();
    while (shapeItr != shapes.constEnd()) {
        (*shapeItr)->applyAccumulatedDelta();
        ++shapeItr;
    }
}
开发者ID:noirsoft,项目名称:hifi,代码行数:22,代码来源:PhysicsSimulation.cpp

示例12: initialize

void QgsComposerManager::initialize()
{
  QSet<QgsComposer*> composers = QgisApp::instance()->printComposers();
  QSet<QgsComposer*>::const_iterator it = composers.constBegin();
  for ( ; it != composers.constEnd(); ++it )
  {
    QListWidgetItem* item = new QListWidgetItem(( *it )->title(), mComposerListWidget );
    item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable );
    mItemComposerMap.insert( item, *it );
  }

  mTemplate->addItem( tr( "Empty composer" ) );

  QMap<QString, QString> templateMap = defaultTemplates();
  if ( templateMap.size() > 0 )
  {
    QMap<QString, QString>::const_iterator templateIt = templateMap.constBegin();
    for ( ; templateIt != templateMap.constEnd(); ++templateIt )
    {
      mTemplate->addItem( templateIt.key(), templateIt.value() );
    }
  }
}
开发者ID:Nald,项目名称:Quantum-GIS,代码行数:23,代码来源:qgscomposermanager.cpp

示例13: setMultiValue

void MultiValuesSpinBox::setMultiValue(QSet<int> value)
{
    if (value.count() == 0)
    {
        mMultiState = MultiValuesEmpty;
        QSpinBox::setValue(minimum());
        setPlaceholder(lineEdit(), "");
    }

    else if (value.count() == 1)
    {
        mMultiState = MultiValuesSingle;
        QSpinBox::setValue(*(value.constBegin()));
        setPlaceholder(lineEdit(), "");
    }

    else
    {
        mMultiState = MultiValuesMulti;
        QSpinBox::setValue(minimum());
        setPlaceholder(lineEdit(), tr("Multiple values"));
    }
}
开发者ID:Zefling,项目名称:flacon,代码行数:23,代码来源:controls.cpp

示例14: needToRenderWithTransparency

// Return true if rendering properties needs to render with transparency
bool GLC_RenderProperties::needToRenderWithTransparency() const
{
	bool renderWithTransparency= false;
	if (m_RenderMode == glc::OverwriteMaterial)
	{
		Q_ASSERT(NULL != m_pOverwriteMaterial);
		renderWithTransparency= m_pOverwriteMaterial->isTransparent();
	}
	else if ((m_RenderMode == glc::OverwriteTransparency) || (m_RenderMode == glc::OverwriteTransparencyAndMaterial))
	{
		Q_ASSERT(-1.0f != m_OverwriteOpacity);
		renderWithTransparency= (m_OverwriteOpacity < 1.0f);
	}
	else if ((m_RenderMode == glc::OverwritePrimitiveMaterial)
			|| ((m_RenderMode == glc::PrimitiveSelected) && (NULL != m_pOverwritePrimitiveMaterialMaps) && (!m_pOverwritePrimitiveMaterialMaps->isEmpty())))
	{
		Q_ASSERT(NULL != m_pOverwritePrimitiveMaterialMaps);
		Q_ASSERT(!m_pOverwritePrimitiveMaterialMaps->isEmpty());

		QList<QHash<GLC_uint, GLC_Material* >* > hashList= m_pOverwritePrimitiveMaterialMaps->values();
		QSet<GLC_Material*> materialSet;
		const int size= hashList.size();
		for (int i= 0; i < size; ++i)
		{
			materialSet.unite(QSet<GLC_Material*>::fromList(hashList.at(i)->values()));
		}

		QSet<GLC_Material*>::const_iterator iMat= materialSet.constBegin();
		while ((materialSet.constEnd() != iMat) && !renderWithTransparency)
		{
			renderWithTransparency= (*iMat)->isTransparent();
			++iMat;
		}
	}

	return renderWithTransparency;
}
开发者ID:MorS25,项目名称:OpenPilot,代码行数:38,代码来源:glc_renderproperties.cpp

示例15: capture

QScriptObjectSnapshot::Delta QScriptObjectSnapshot::capture(const QScriptValue &object)
{
    Delta result;
    QMap<QString, QScriptValueProperty> currProps;
    QHash<QString, int> propertyNameToIndex;
    {
        int i = 0;
        QScriptValueIterator it(object);
        while (it.hasNext()) {
            it.next();
            QScriptValueProperty prop(it.name(), it.value(), it.flags());
            currProps.insert(it.name(), prop);
            propertyNameToIndex.insert(it.name(), i);
            ++i;
        }
        if (object.prototype().isValid()) {
            QString __proto__ = QString::fromLatin1("__proto__");
            QScriptValueProperty protoProp(
                __proto__, object.prototype(),
                QScriptValue::Undeletable | QScriptValue::ReadOnly);
            currProps.insert(__proto__, protoProp);
            propertyNameToIndex.insert(__proto__, i);
            ++i;
        }
    }

    QSet<QString> prevSet;
    for (int i = 0; i < m_properties.size(); ++i)
        prevSet.insert(m_properties.at(i).name());
    QSet<QString> currSet = currProps.keys().toSet();
    QSet<QString> removedProperties = prevSet - currSet;
    QSet<QString> addedProperties = currSet - prevSet;
    QSet<QString> maybeChangedProperties = currSet & prevSet;

    {
        QMap<int, QScriptValueProperty> am;
        QSet<QString>::const_iterator it;
        for (it = addedProperties.constBegin(); it != addedProperties.constEnd(); ++it) {
            int idx = propertyNameToIndex[*it];
            am[idx] = currProps[*it];
        }
        result.addedProperties = am.values();
    }

    {
        QSet<QString>::const_iterator it;
        for (it = maybeChangedProperties.constBegin(); it != maybeChangedProperties.constEnd(); ++it) {
            const QScriptValueProperty &p1 = currProps[*it];
            const QScriptValueProperty &p2 = findProperty(*it);
            if (!_q_equal(p1.value(), p2.value())
                || (p1.flags() != p2.flags())) {
                result.changedProperties.append(p1);
            }
        }
    }

    result.removedProperties = removedProperties.toList();

    m_properties = currProps.values();

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


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