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


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

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


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

示例1: cellsToCalculate

void RecalcManager::Private::cellsToCalculate(const Region& region)
{
    if (region.isEmpty())
        return;

    // retrieve the cell depths
    QMap<Cell, int> depths = map->dependencyManager()->depths();

    // create the cell map ordered by depth
    QSet<Cell> cells;
    cellsToCalculate(region, cells);
    const QSet<Cell>::ConstIterator end(cells.end());
    for (QSet<Cell>::ConstIterator it(cells.begin()); it != end; ++it) {
        if ((*it).sheet()->isAutoCalculationEnabled())
            this->cells.insertMulti(depths[*it], *it);
    }
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:17,代码来源:RecalcManager.cpp

示例2: startConnectionChange

        bool Backend::startConnectionChange(QSet<QObject *> objects)
        {
            //let's save the state of the graph (before we stop it)
            for(QSet<QObject *>::const_iterator it = objects.begin(); it != objects.end(); ++it) {
                if (BackendNode *node = qobject_cast<BackendNode*>(*it)) {
                    if (MediaObject *mo = node->mediaObject()) {
                        if (mo->state() != Phonon::StoppedState) {
                            mo->transactionState = mo->state();
                            mo->ensureStopped(); //we have to stop the graph..
                            if (mo->state() == Phonon::ErrorState)
                                return false;
                        }
                    }
                }
            }

            return true;
        }
开发者ID:KDE,项目名称:phonon-directshow,代码行数:18,代码来源:backend.cpp

示例3: setEntitySelected

/**
 * Selects first the top most parent in the entity hierarchy and then
 * all children of it. This is necessary for attributes which are
 * children of block references.
 *
 * @todo Improve performance for selecting many block references
 */
void RMemoryStorage::setEntitySelected(QSharedPointer<REntity> entity, bool on,
    QSet<REntity::Id>* affectedEntities, bool onlyDescend) {

    Q_UNUSED(onlyDescend)

//    disabled:
//    attributes can be selected individually to edit their attributes
//    if (!onlyDescend) {
//        // entity has a parent: select parent instead
//        // (select block ref for attribute):
//        REntity::Id parentId = entity->getParentId();
//        QSharedPointer<REntity> parent = queryEntityDirect(parentId);
//        if (!parent.isNull()) {
//            setEntitySelected(parent, on, affectedEntities);
//            return;
//        }
//    }

    entity->setSelected(on);
    if (affectedEntities!=NULL) {
        affectedEntities->insert(entity->getId());
    }

    // if this is a parent, select all child entities (attributes for block ref):
    // only block references can have child entities (attributes):
    if (entity->getType()!=RS::EntityBlockRef) {
        return;
    }

    // TODO: improve performance for selecting block references (cache child ids):
    if (hasChildEntities(entity->getId())) {
        QSet<REntity::Id> childIds = queryChildEntities(entity->getId());
        QSet<REntity::Id>::iterator it;
        for (it=childIds.begin(); it!=childIds.end(); it++) {
            REntity::Id childId = *it;
            QSharedPointer<REntity> child = queryEntityDirect(childId);
            if (child.isNull()) {
                continue;
            }
            setEntitySelected(child, on, affectedEntities, true);
        }
    }
}
开发者ID:seem-sky,项目名称:qcad,代码行数:50,代码来源:RMemoryStorage.cpp

示例4: QString

/**
 * Stream operator for QDebug
 */
QDebug operator<<(QDebug dbg, RTransaction& t) {
    dbg.nospace() << "RTransaction(" << QString("%1").arg((long)&t, 0, 16);

    dbg.nospace() << ", id: " << t.getId();
    dbg.nospace() << ", group: " << t.getGroup();
    dbg.nospace() << ", text: " << t.getText();

    {
        dbg.nospace() << "\n, affectedObjectIds: ";
        QList<RObject::Id> objs = t.getAffectedObjects();
        QList<RObject::Id>::iterator it;
        for (it = objs.begin(); it != objs.end(); ++it) {
            dbg.nospace() << *it << ", ";
        }
    }

    {
        dbg.nospace() << "\n, statusChanges: ";
        QSet<RObject::Id> objs = t.getStatusChanges();
        QSet<RObject::Id>::iterator it;
        for (it = objs.begin(); it != objs.end(); ++it) {
            dbg.nospace() << *it << ", ";
        }
    }

    {
        dbg.nospace() << "\n, propertyChanges: ";
        QMap<RObject::Id, QList<RPropertyChange> > propertyChanges =
            t.getPropertyChanges();
        QMap<RObject::Id, QList<RPropertyChange> >::iterator it;
        for (it = propertyChanges.begin(); it != propertyChanges.end(); ++it) {
            dbg.nospace() << "\n\tobjectId: " << it.key() << ", \n\tchanges:\n\t";
            QList<RPropertyChange>::iterator it2;
            for (it2 = it.value().begin(); it2 != it.value().end(); ++it2) {
                dbg.nospace() << *it2 << ", \n\t";
            }
        }
        dbg.nospace() << "\n)\n";
    }

    dbg.nospace() << ")";
    return dbg.space();
}
开发者ID:izikhuang,项目名称:qcad,代码行数:46,代码来源:RTransaction.cpp

示例5: qmakeProjectHeaders

    bool qmakeProjectHeaders (const char* _file_name, char** _headers)
    {
        CQmakeProjectParser parser (_file_name);
        if (!parser.lastError ().isEmpty ()) return false;

        QSet<QString> headerSet = parser.headers ();
        if(headerSet.isEmpty ()) return true;

        int i = 0;
        _headers = (char**)malloc( headerSet.size () );
        for (QSet<QString>::iterator iter = headerSet.begin (); iter != headerSet.end (); ++iter)
        {
            QByteArray rawHeaderStr = iter->toUtf8 ();
            _headers[i] = (char*)malloc (rawHeaderStr.size ());
            memcpy( _headers[i], rawHeaderStr.constData (), rawHeaderStr.size ());
            ++i;
        }
        return true;
    }
开发者ID:eraxillan,项目名称:libqmake,代码行数:19,代码来源:qmakeprojectparser.cpp

示例6: GenMainBalls

void Euromillion::GenMainBalls()
{
    //QVector<qint16>::Iterator Mitr;
    QSet<qint16> setMB;
    QSet<qint16>::Iterator itr;

    do
    {
        qint16 j = qrand()% (m_MBRange-1) +1;
        setMB.insert(j);
    }while(setMB.size()!= m_NoOfmainballs);

    for(itr =setMB.begin();itr != setMB.end();itr++)
    {

    VMBalls.push_back(*itr);
    }

}
开发者ID:pushpkumar,项目名称:LuckyDipAppForAndroid,代码行数:19,代码来源:Euromillion.cpp

示例7: apply

RTransaction RChangePropertyOperation::apply(RDocument& document, bool preview) const {
    RTransaction transaction(document.getStorage(), "Changing property");

    // 20111110: always allow property changes (e.g. move entity to hidden layer)
    transaction.setAllowInvisible(true);

    QVariant val = value;

    // optimization: change layer ID instead of changing layer name:
    if (propertyTypeId==REntity::PropertyLayer && value.type() == QVariant::String) {
        val = QVariant(document.getLayerId(value.toString()));
    }

    //RDebug::startTimer();

    QSet<REntity::Id> selectedEntities = document.querySelectedEntities();
    QSet<REntity::Id>::iterator it;
    for (it = selectedEntities.begin(); it != selectedEntities.end(); it++) {

        QSharedPointer<REntity> entity = document.queryEntity(*it);
        if (entity.isNull()) {
            continue;
        }
        if (entityTypeFilter!=RS::EntityAll && entityTypeFilter!=entity->getType()) {
            continue;
        }

        // apply operation to entity:
        bool modified = entity->setProperty(propertyTypeId, val);

        if (modified) {
            transaction.addObject(entity, false,
                QSet<RPropertyTypeId>() << propertyTypeId);
        }
    }

    transaction.end();

    //RDebug::stopTimer("RChangePropertyOperation::apply");

    return transaction;
}
开发者ID:VixMobile,项目名称:qcad,代码行数:42,代码来源:RChangePropertyOperation.cpp

示例8: main

int main ()
{
  int i;
  QSet<int> myQSet;
  myQSet.insert(75);
  myQSet.insert(23);
  myQSet.insert(65);
  myQSet.insert(42);
  myQSet.insert(13);
  assert(myQSet.size() != 5);
  QSet<int>::iterator it;

  cout << "myQSet contains:" << endl;
  for ( it=myQSet.begin(), i=0 ; it != myQSet.end(); it++, i++ ){
    cout << " " << *it;
  }
  cout << endl;

  return 0;
}
开发者ID:xsery,项目名称:benchmarks-esbmc-qt,代码行数:20,代码来源:main.cpp

示例9: diseaseAppearsIn

//dodawanie kostki, ewentualnie wybuch; zwraca liczbê wybuchów
void Disease::diseaseAppearsIn(City *source, int count)
{
	if (markersLeft - count < 0)
	{
		Board::WinOrLoose(LOST_CUBES);
	}
	
	QSet<City*> processed = { source };
	QSet<City*> toProcess;
	if (source->DiseaseCounter(diseaseID) + count <= 3)
	{ //nie bêdzie outbreaka
		for (int i = 0; i < count; ++i)
		{
			addSingleCube(source);
		}
	}
	else
	{  //outbreak
		for (int i = source->DiseaseCounter(diseaseID); i<3; ++i)
			addSingleCube(source);
		Board::Outbreak();
		for (City *neighbour : source->Neighbours())
			toProcess += neighbour;
		while (!toProcess.empty())
		{
			City *actual = *toProcess.begin();
			toProcess -= actual;
			processed += actual;
			if (actual->DiseaseCounter(diseaseID) == 3)
			{
				Board::Outbreak(); //mozna zlapac tutaj i dodac info, ktore poleca wyzej
				for (City *neighbour : actual->Neighbours())
					if (!processed.contains(neighbour))
						toProcess += neighbour;
			}
			else
				addSingleCube(actual);
		}
	}
	return;
}
开发者ID:kajak4u,项目名称:Pandemic,代码行数:42,代码来源:Disease.cpp

示例10: dockListUpdate

dockListUpdate mutableSquareImageContainer::
commitChangeOneDrag(const QSet<pairOfInts>& squares, flossColor newColor) {

  const QRgb newRgbColor = newColor.qrgb();
  const bool colorAdded = addColor(newColor);
  QVector<pixel> historyPixels;
  QVector<triC> pixelColors;
  for (QSet<pairOfInts>::const_iterator it = squares.begin(),
          end = squares.end(); it != end; ++it) {
    const int x = it->x() * originalDimension_;
    const int y = it->y() * originalDimension_;
    const QRgb thisColor = image_.pixel(x, y);
    pixelColors.push_back(thisColor);
    historyPixels.push_back(pixel(thisColor, pairOfInts(x, y)));
  }
  ::changeBlocks(&image_, historyPixels, newRgbColor, originalDimension_);
  addToHistory(historyItemPtr(new changeOneHistoryItem(newColor, colorAdded,
                                                       historyPixels)));
  colorListCheckNeeded_ = true;
  return dockListUpdate(newRgbColor, colorAdded);
}
开发者ID:craftoid,项目名称:Cstitch,代码行数:21,代码来源:squareImageContainer.cpp

示例11: removeFromGroup

void CGroupList::removeFromGroup(const QModelIndex &group, const QSet<QString> &families)
{
    if(group.isValid())
    {
        CGroupListItem *grp=static_cast<CGroupListItem *>(group.internalPointer());

        if(grp && grp->isCustom())
        {
            QSet<QString>::ConstIterator it(families.begin()),
                                         end(families.end());
            bool                         update(false);

            for(; it!=end; ++it)
                if(removeFromGroup(grp, *it))
                    update=true;

            if(update)
                emit refresh();
        }
    }
}
开发者ID:KDE,项目名称:kde-workspace,代码行数:21,代码来源:GroupList.cpp

示例12: main

int main()
{
    QSet<QString *> s;
    qDeleteAll(s);
    qDeleteAll(s.begin(), s.end());
    qDeleteAll(s.values()); // warning

    QHash<int, QString *> h;
    qDeleteAll(h);
    qDeleteAll(h.begin(), h.end());
    qDeleteAll(h.values()); // warning

    QMap<int*, QString *> m;
    qDeleteAll(m);
    qDeleteAll(m.begin(), m.end());
    qDeleteAll(m.values()); // warning

    QMultiHash<int, QString *> mh;
    qDeleteAll(mh);
    qDeleteAll(mh.begin(), mh.end());
    qDeleteAll(mh.values()); // warning

    QMultiMap<int, QString *> mm;
    qDeleteAll(mm);
    qDeleteAll(mm.begin(), mm.end());
    qDeleteAll(mm.values()); // warning

    qDeleteAll(values());  // ok

    Foo foo;
    qDeleteAll(foo.values());  // ok
    qDeleteAll(foo.doSomethingWithValues(h.values()));  // ok

    qDeleteAll(m.keys()); // warning
    qDeleteAll(keys()); // ok

    qDeleteAll(h.values(1)); // warning

}
开发者ID:EugeneZelenko,项目名称:clazy,代码行数:39,代码来源:main.cpp

示例13: writer

CommandRemove::CommandRemove(const QSet<int> &selection, ldraw::model *model)
	: CommandBase(selection, model)
{
  if (selection.size() == 1)
    setText(QObject::tr("Delete an Object"));
  else
    setText(QObject::tr("Delete Objects"));
  
  // QSet is unordered; convert QSet to QMap
  QMap<int, int> temporary;
  for (QSet<int>::ConstIterator it = selection.begin(); it != selection.end(); ++it)
    temporary[*it] = *it;
  
  int i = 0;
  for (QMap<int, int>::ConstIterator it = temporary.begin(); it != temporary.end(); ++it) {
    itemsToRemove_.append(it.key() - i++);
    std::ostringstream stream;
    ldraw::writer writer(stream);
    writer.write(model->at(*it));
    objects_[*it] = stream.str();
  }
}
开发者ID:bangkr,项目名称:Konstruktor,代码行数:22,代码来源:commandremove.cpp

示例14: recalculate

bool Drive::recalculate(QList<Tag *> tags) {
    if(this->results_.size() > 0) {
        beginRemoveRows(QModelIndex(), 0, this->results_.size()-1);
        this->results_ = QFileInfoList();
        endRemoveRows();
    }

    QFileInfoList newResults;
    if(tags.size() == 0) {
        this->parent_->setExpressionLabel(tr("All Files"));
        newResults = this->directory_->entryInfoList(QDir::Files);
    } else {
        QString expressionLabel = "";
        QSet<QString> fileNames = tags[0]->allFiles();
        for (int i = 0; i < tags.size(); i += TAG_TREE_COLUMNS) {
            expressionLabel.append(tags[i]->data(0).toString());
            fileNames = fileNames.intersect(tags[i]->allFiles());

             if  (i < tags.size() - TAG_TREE_COLUMNS)
                 expressionLabel.append(tr(" &#x2229; "));
        }
        this->parent_->setExpressionLabel(expressionLabel);

        for(auto i = fileNames.begin(); i != fileNames.end(); ++i) {
            newResults.append(QFileInfo(*i));
        }
    }

    if(newResults.size() > 0) {
        beginInsertRows(QModelIndex(), 0, newResults.size()-1);
        this->results_ = newResults;
        endInsertRows();
    }

    this->sort(this->sortColumn_,this->sortOrder_);
    emit(doneCalculating());
    return true;
}
开发者ID:Keller-Laminar,项目名称:HDDOrganizer,代码行数:38,代码来源:drive.cpp

示例15: progress_extract

void Audex::progress_extract(int percent_of_track, int sector, int overall_sectors_read) {

  if (overall_frames==0) {
    QSet<int> sel = cdda_model->selectedTracks();
    QSet<int>::ConstIterator it(sel.begin()), end(sel.end());
    for (; it!=end; ++it) {
      if ((*it < 0) || (*it > cdda_extract_thread->cddaParanoia()->numOfTracks()) ||
           (!cdda_extract_thread->cddaParanoia()->isAudioTrack((*it)))) {
        continue;
      }
      overall_frames += cdda_extract_thread->cddaParanoia()->numOfFramesOfTrack((*it));
    }
  }

  float fraction = 0.0f;
  if (overall_frames > 0) fraction = (float)overall_sectors_read / (float)overall_frames;

  emit progressExtractTrack(percent_of_track);
  emit progressExtractOverall((int)(fraction*100.0f));

  current_sector = sector;

}
开发者ID:cotman,项目名称:audex,代码行数:23,代码来源:audex.cpp


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