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


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

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


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

示例1: fillNeighborStructures

void MeshGenerator::fillNeighborStructures()
{
    QList<QSet<int> > vertexElements;
    vertexElements.reserve(nodeList.count());
    for (int i = 0; i < nodeList.count(); i++)
        vertexElements.push_back(QSet<int>());

    for (int i = 0; i < elementList.count(); i++)
        if (elementList[i].isUsed)
            for (int elemNode = 0; elemNode < (elementList[i].isTriangle() ? 3 : 4); elemNode++)
                vertexElements[elementList[i].node[elemNode]].insert(i);

    for (int i = 0; i < edgeList.count(); i++)
    {
        if (edgeList[i].isUsed && edgeList[i].marker != -1)
        {
            QSet<int> neighbours = vertexElements[edgeList[i].node[0]];
            neighbours.intersect(vertexElements[edgeList[i].node[1]]);
            assert((neighbours.size() > 0) && (neighbours.size() <= 2));
            edgeList[i].neighElem[0] = neighbours.values()[0];
            if (neighbours.size() == 2)
                edgeList[i].neighElem[1] = neighbours.values()[1];
        }
    }
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例2: getSafestCell

Cell* Grid::getSafestCell() const
{
	QSet<Cell*> remainingCells;

	// find the most constrained cells (fewest options in domain)
	int minimumDomainSize = 100;
	for( auto cellIter=cells.begin(); cellIter!=cells.end(); ++cellIter )
	{
		Cell* cell = *cellIter;
		if( cell->value() != Cell::UNKNOWN )
			continue;

		if( cell->domain().size() < minimumDomainSize ){
			minimumDomainSize = cell->domain().size();
			remainingCells.clear();
		}
		if( cell->domain().size() == minimumDomainSize ){
			remainingCells.insert(cell);
		}
	}

	// if there are no cells return null, otherwise return a minimum cell
	if( remainingCells.size() == 0 )
		return nullptr;
	else
		return remainingCells.values()[0];
}
开发者ID:stevenvergenz,项目名称:c-voku,代码行数:27,代码来源:grid_csp.cpp

示例3: initView

void IndicatorDataView::initView(const QString& indicator)
{
  if(!mPainter->mIndicator) return;

  mIndicator = indicator;

  // Delete old entries

  // Insert new entries
  QStringList var;
  //mPainter->mData->getVariableNames(var);
  QSet<QString> varList;
  mPainter->mIndicator->getVariableNames(&varList);
  var = varList.values();
  //qDebug() << "IndicatorDataView::initView()" << var << varList.size();

  // Sort the variable list, but place the bardata as block in front
  var.removeAt(var.indexOf("OPEN"));
  var.removeAt(var.indexOf("HIGH"));
  var.removeAt(var.indexOf("LOW"));
  var.removeAt(var.indexOf("CLOSE"));
  var.removeAt(var.indexOf("VOLUME"));
  var.removeAt(var.indexOf("OPINT"));
  var.sort();
  var.prepend("OPINT");
  var.prepend("VOLUME");
  var.prepend("CLOSE");
  var.prepend("LOW");
  var.prepend("HIGH");
  var.prepend("OPEN");
  var.prepend("Date"); // Should not be a variable but is also interesting

  // And now insert entries
  int row = 0;
  QString name;
  QCheckBox* cb;

  mFilterView.setColumnCount(1);
  mFilterView.setRowCount(var.size());

  // Restore saved settings, if some
  QString filterPath;
  filterPath = mRcFile->getPath("FiluHome");
  filterPath.append("IndicatorFilterSettings/");
  SettingsFile sfile(filterPath + mIndicator);

  foreach(name, var)
  {
    cb = new QCheckBox(name);
    if(sfile.getBL(name))
    {
      cb->setCheckState(Qt::Checked);
    }
    else
    {
      cb->setCheckState(Qt::Unchecked);
    }
    connect(cb, SIGNAL(stateChanged(int)), this, SLOT(filterChanged(int)));
    mFilterView.setCellWidget(row++, 0, cb);
  }
开发者ID:loh-tar,项目名称:filu,代码行数:60,代码来源:IndicatorDataView.cpp

示例4: GetNameForNewPlaylist

QString PlaylistManager::GetNameForNewPlaylist(const SongList& songs) {
  if (songs.isEmpty()) {
    return tr("Playlist");
  }

  QSet<QString> artists;
  QSet<QString> albums;

  for (const Song& song : songs) {
    artists << (song.artist().isEmpty() ? tr("Unknown") : song.artist());
    albums << (song.album().isEmpty() ? tr("Unknown") : song.album());

    if (artists.size() > 1) {
      break;
    }
  }

  bool various_artists = artists.size() > 1;

  QString result;
  if (various_artists) {
    result = tr("Various artists");
  } else {
    result = artists.values().first();
  }

  if (!various_artists && albums.size() == 1) {
    result += " - " + albums.toList().first();
  }

  return result;
}
开发者ID:Fat-Zer,项目名称:Clementine,代码行数:32,代码来源:playlistmanager.cpp

示例5: 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

示例6: getRelevantTriangles

void MeshOctTree::getRelevantTriangles(QList<Triangle> &list, glm::vec3 pt, glm::vec3 dir){

    QSet<Triangle> tris;

    QList<OctTreeNode*> queue;
    queue.append(m_root);

    while (!queue.isEmpty()){
        OctTreeNode *current = queue.takeFirst();

        if (rayIntersectsCube(pt, dir, current->min, current->max)){
            if (current->children == NULL){
                for (int i = 0; i < current->triangles.size(); i++){
                    tris.insert(current->triangles.at(i));
                }
            } else {
                for (int i = 0; i < 8; i++){
                    queue.append(current->children[i]);
                }
            }
        }
    }

    list = tris.values();
}
开发者ID:ArtisticCoding,项目名称:hair,代码行数:25,代码来源:meshocttree.cpp

示例7:

QList<kint> VertexBuffer::mergeVerticesIndices(const QList<kint>& v1, const QList<kint>& v2) const
{
	QSet<kint> set = QSet<kint>::fromList(v1);
	set.unite(QSet<kint>::fromList(v2));

	QList<kint> result = set.values();
	qSort(result);
	return result;
}
开发者ID:rcari,项目名称:libNigel,代码行数:9,代码来源:VertexBuffer.cpp

示例8: optionsToString

static QString optionsToString(int options)
{
    QSet<QString> set;
    if (options & 1)
        set.insert("strict");
    if (options & 2)
        set.insert("werror");
    if (options & 4)
        set.insert("atline");
    if (options & 8)
        set.insert("xml");
    return QStringList(set.values()).join(",");
}
开发者ID:dewhisna,项目名称:emscripten-qt,代码行数:13,代码来源:tst_qscriptjstestsuite.cpp

示例9: removeSelectedButtonPushed

void QgsValueMapConfigDlg::removeSelectedButtonPushed()
{
  QList<QTableWidgetItem *> list = tableWidget->selectedItems();
  QSet<int> rowsToRemove;
  int removed = 0;
  int i;
  for ( i = 0; i < list.size(); i++ )
  {
    if ( list[i]->column() == 0 )
    {
      int row = list[i]->row();
      if ( !rowsToRemove.contains( row ) )
      {
        rowsToRemove.insert( row );
      }
    }
  }
  for ( i = 0; i < rowsToRemove.values().size(); i++ )
  {
    tableWidget->removeRow( rowsToRemove.values().at( i ) - removed );
    removed++;
  }
}
开发者ID:dakcarto,项目名称:QGIS,代码行数:23,代码来源:qgsvaluemapconfigdlg.cpp

示例10:

QList<QString> QgsRuleBasedRendererV2::usedAttributes()
{
  QSet<QString> attrs;
  for ( QList<Rule>::iterator it = mRules.begin(); it != mRules.end(); ++it )
  {
    Rule& rule = *it;
    attrs.unite( rule.needsFields().toSet() );
    if ( rule.symbol() )
    {
      attrs.unite( rule.symbol()->usedAttributes() );
    }
  }
  return attrs.values();
}
开发者ID:CzendaZdenda,项目名称:qgis,代码行数:14,代码来源:qgsrulebasedrendererv2.cpp

示例11: removeSelectedButtonPushed

void QgsAttributeTypeDialog::removeSelectedButtonPushed()
{
  QList<QTableWidgetItem *> list = tableWidget->selectedItems();
  QList<QTableWidgetItem *>::iterator it = list.begin();
  QSet<int> rowsToRemove;
  int removed = 0;
  int i = 0;
  for ( ; i < list.size(); i++ )
  {
    if ( list[i]->column() == 0 )
    {
      int row = list[i]->row();
      if ( !rowsToRemove.contains( row ) )
      {
        rowsToRemove.insert( row );
      }
    }
  }
  for ( i = 0; i < rowsToRemove.values().size(); i++ )
  {
    tableWidget->removeRow( rowsToRemove.values()[i] - removed );
    removed++;
  }
}
开发者ID:mmubangizi,项目名称:qgis,代码行数:24,代码来源:qgsattributetypedialog.cpp

示例12: if

QString OsmAnd::Utilities::stringifyZoomLevels(const QSet<ZoomLevel>& zoomLevels)
{
    QString result;

    auto sortedZoomLevels = zoomLevels.values();
    std::sort(sortedZoomLevels);
    bool previousCaptured = false;
    ZoomLevel previousZoomLevel = sortedZoomLevels.first();
    bool range = false;
    ZoomLevel rangeStart;
    for (const auto zoomLevel : sortedZoomLevels)
    {
        if (previousCaptured && static_cast<int>(zoomLevel) == static_cast<int>(previousZoomLevel)+1)
        {
            if (!range)
                rangeStart = previousZoomLevel;
            range = true;
            previousZoomLevel = zoomLevel;
            previousCaptured = true;
        }
        else if (range)
        {
            range = false;
            previousZoomLevel = zoomLevel;
            previousCaptured = true;

            result += QString::fromLatin1("%1-%2, %3, ").arg(rangeStart).arg(previousZoomLevel).arg(zoomLevel);
        }
        else
        {
            previousZoomLevel = zoomLevel;
            previousCaptured = true;

            result += QString::fromLatin1("%1, ").arg(zoomLevel);
        }
    }

    // Process last range
    if (range)
        result += QString::fromLatin1("%1-%2, ").arg(rangeStart).arg(sortedZoomLevels.last());

    if (result.length() > 2)
        result.truncate(result.length() - 2);

    return result;
}
开发者ID:vasvlad,项目名称:OsmAnd-core,代码行数:46,代码来源:Utilities.cpp

示例13: threadFinished

void RepositoryProfile::threadFinished()
{
  repositoryContent = lister->getRepoPackageInformations();
  localContent = lister->getLocalPackageInformations();

  // create a list of provided packages for faster access later
  QSet<QString> c;
  foreach ( const QString &arch, repositoryContent.keys() ) {
    foreach ( const QString &name, repositoryContent.value ( arch ).keys() ) {
      c << name;
    }
  }

  repoContent = c.values();

  updatePackagesStatus();
  computeProfileStatus();
  emit ( statusRefreshed() );
}
开发者ID:dhamonex,项目名称:rpmdownloader,代码行数:19,代码来源:repositoryprofile.cpp

示例14: reset

void IncludeFileDataProvider::reset()
{
  m_lastSearchedPrefix = QString();
  m_duContext = TopDUContextPointer();
  m_baseUrl = KUrl();
  m_importers.clear();
  
  IDocument* doc = ICore::self()->documentController()->activeDocument();

  if( doc )
  {
    m_baseUrl = doc->url();

    {
      DUChainReadLocker lock( DUChain::lock() );
      m_duContext = TopDUContextPointer( ICore::self()->languageController()->language("C++")->languageSupport()->standardContext( doc->url() )  );

      if( m_allowImporters && m_duContext ) {
        QSet<IndexedString> importers;

        collectImporters( importers, m_duContext.data() );

        m_importers = importers.values();
      }
    }
  }
  
  QList<IncludeItem> allIncludeItems;

  if( m_allowPossibleImports )
    allIncludeItems += CppUtils::allFilesInIncludePath( m_baseUrl, true, QString(), KUrl::List(), false, true, true );

  if( m_allowImports )
    allIncludeItems += getAllIncludedItems( m_duContext );
  
  foreach( const IndexedString &u, m_importers ) {
    IncludeItem i;
    i.isDirectory = false;
    i.name = u.str();
    i.pathNumber = -1; //We mark this as an importer by putting pathNumber to -1
    allIncludeItems << i;
  }
开发者ID:,项目名称:,代码行数:42,代码来源:

示例15: bindVertices

void VertexBuffer::bindVertices(const QList<kint>& verticesIndices, kbool doCleanList)
{
	QList<kint> vertices;
	if(doCleanList)
	{
		QSet<kint> set = QSet<kint>::fromList(verticesIndices);
		vertices = set.values();
		qSort(vertices);
	}
	else
	{
		vertices = verticesIndices; // No deep copy (implicitly shared classes !).
	}

	for(kint i = 0; i < vertices.size(); i++)
	{
		kint nextIndex = (i + 1) % vertices.size();
		_verticesData[i].nextSharedVertex = vertices.at(nextIndex);
	}
}
开发者ID:rcari,项目名称:libNigel,代码行数:20,代码来源:VertexBuffer.cpp


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