本文整理汇总了C++中QSet::unite方法的典型用法代码示例。如果您正苦于以下问题:C++ QSet::unite方法的具体用法?C++ QSet::unite怎么用?C++ QSet::unite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSet
的用法示例。
在下文中一共展示了QSet::unite方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testExpr
QList<QString> QgsGraduatedSymbolRendererV2::usedAttributes()
{
QSet<QString> attributes;
// mAttrName can contain either attribute name or an expression.
// Sometimes it is not possible to distinguish between those two,
// e.g. "a - b" can be both a valid attribute name or expression.
// Since we do not have access to fields here, try both options.
attributes << mAttrName;
QgsExpression testExpr( mAttrName );
if ( !testExpr.hasParserError() )
attributes.unite( testExpr.referencedColumns().toSet() );
if ( mRotation.data() ) attributes.unite( mRotation->referencedColumns().toSet() );
if ( mSizeScale.data() ) attributes.unite( mSizeScale->referencedColumns().toSet() );
QgsRangeList::const_iterator range_it = mRanges.constBegin();
for ( ; range_it != mRanges.constEnd(); ++range_it )
{
QgsSymbolV2* symbol = range_it->symbol();
if ( symbol )
{
attributes.unite( symbol->usedAttributes() );
}
}
return attributes.toList();
}
示例2: generateProjectTree
void ServerModeReader::generateProjectTree(CMakeListsNode *root,
const QList<const FileNode *> &allFiles)
{
// Split up cmake inputs into useful chunks:
QList<FileNode *> cmakeFilesSource;
QList<FileNode *> cmakeFilesBuild;
QList<FileNode *> cmakeFilesOther;
QList<FileNode *> cmakeLists;
foreach (FileNode *fn, m_cmakeInputsFileNodes) {
const FileName path = fn->filePath();
if (path.fileName().compare("CMakeLists.txt", HostOsInfo::fileNameCaseSensitivity()) == 0)
cmakeLists.append(fn);
else if (path.isChildOf(m_parameters.sourceDirectory))
cmakeFilesSource.append(fn);
else if (path.isChildOf(m_parameters.buildDirectory))
cmakeFilesBuild.append(fn);
else
cmakeFilesOther.append(fn);
}
m_cmakeInputsFileNodes.clear(); // Clean out, they are not going to be used anymore!
if (!m_projects.isEmpty())
root->setDisplayName(m_projects.at(0)->name);
QSet<Node *> usedNodes;
usedNodes.insert(updateCMakeInputs(root, m_parameters.sourceDirectory, m_parameters.buildDirectory,
cmakeFilesSource, cmakeFilesBuild, cmakeFilesOther));
usedNodes.unite(updateCMakeLists(root, cmakeLists));
usedNodes.unite(updateProjects(root, m_projects, allFiles));
// Trim out unused nodes:
root->trim(usedNodes);
}
示例3: updateWin
void TcpPortsGathererPrivate::updateWin()
{
#ifdef Q_OS_WIN
QSet<int> ports;
if (protocol == QAbstractSocket::IPv4Protocol) {
ports.unite(usedTcpPorts<MIB_TCPTABLE>(GetTcpTable));
} else {
//Dynamically load symbol for GetTcp6Table for systems that dont have support for IPV6,
//eg Windows XP
typedef ULONG (__stdcall *GetTcp6TablePtr)(PMIB_TCP6TABLE, PULONG, BOOL);
static GetTcp6TablePtr getTcp6TablePtr = 0;
if (!getTcp6TablePtr)
getTcp6TablePtr = (GetTcp6TablePtr)QLibrary::resolve(QLatin1String("Iphlpapi.dll"),
"GetTcp6Table");
if (getTcp6TablePtr && (protocol == QAbstractSocket::IPv6Protocol)) {
ports.unite(usedTcpPorts<MIB_TCP6TABLE>(getTcp6TablePtr));
} else if (protocol == QAbstractSocket::UnknownNetworkLayerProtocol) {
ports.unite(usedTcpPorts<MIB_TCPTABLE>(GetTcpTable));
if (getTcp6TablePtr)
ports.unite(usedTcpPorts<MIB_TCP6TABLE>(getTcp6TablePtr));
}
}
foreach (int port, ports)
usedPorts.insert(port);
#endif
Q_UNUSED(protocol);
}
示例4: updateWin
void TcpPortsGathererPrivate::updateWin(TcpPortsGatherer::ProtocolFlags protocolFlags)
{
#ifdef Q_OS_WIN
QSet<int> ports;
if (protocolFlags & TcpPortsGatherer::IPv4Protocol)
ports.unite(usedTcpPorts<MIB_TCPTABLE>(GetTcpTable));
//Dynamically load symbol for GetTcp6Table for systems that dont have support for IPV6,
//eg Windows XP
typedef ULONG (__stdcall *GetTcp6TablePtr)(PMIB_TCP6TABLE, PULONG, BOOL);
static GetTcp6TablePtr getTcp6TablePtr = 0;
if (!getTcp6TablePtr)
getTcp6TablePtr = (GetTcp6TablePtr)QLibrary::resolve(QLatin1String("Iphlpapi.dll"),
"GetTcp6Table");
if (getTcp6TablePtr && (protocolFlags & TcpPortsGatherer::IPv6Protocol))
ports.unite(usedTcpPorts<MIB_TCP6TABLE>(getTcp6TablePtr));
foreach (int port, ports) {
if (!usedPorts.contains(port))
usedPorts.addPort(port);
}
#endif
Q_UNUSED(protocolFlags);
}
示例5: collectAllElements
QSet<XsdElement::Ptr> collectAllElements(const XsdSchema::Ptr &schema)
{
QSet<XsdElement::Ptr> elements;
// collect global elements
const XsdElement::List elementList = schema->elements();
for (int i = 0; i < elementList.count(); ++i)
elements.insert(elementList.at(i));
// collect all elements from global groups
const XsdModelGroup::List groupList = schema->elementGroups();
for (int i = 0; i < groupList.count(); ++i) {
const XsdModelGroup::Ptr group(groupList.at(i));
for (int j = 0; j < group->particles().count(); ++j)
elements.unite(collectAllElements(group->particles().at(j)));
}
// collect all elements from complex type definitions
SchemaType::List types;
types << schema->types() << schema->anonymousTypes();
for (int i = 0; i < types.count(); ++i) {
if (types.at(i)->isComplexType() && types.at(i)->isDefinedBySchema()) {
const XsdComplexType::Ptr complexType(types.at(i));
if (complexType->contentType()->particle())
elements.unite(collectAllElements(complexType->contentType()->particle()));
}
}
return elements;
}
示例6:
QList<QString> QgsSingleSymbolRendererV2::usedAttributes()
{
QSet<QString> attributes;
if ( mSymbol.data() ) attributes.unite( mSymbol->usedAttributes() );
if ( mRotation.data() ) attributes.unite( mRotation->referencedColumns().toSet() );
if ( mSizeScale.data() ) attributes.unite( mSizeScale->referencedColumns().toSet() );
return attributes.toList();
}
示例7: clearProfileAssignments
void AutoProfileWatcher::clearProfileAssignments()
{
QSet<AutoProfileInfo*> terminateProfiles;
QListIterator<QList<AutoProfileInfo*> > iterDelete(appProfileAssignments.values());
while (iterDelete.hasNext())
{
QList<AutoProfileInfo*> templist = iterDelete.next();
terminateProfiles.unite(templist.toSet());
}
appProfileAssignments.clear();
QListIterator<QList<AutoProfileInfo*> > iterClassDelete(windowClassProfileAssignments.values());
while (iterClassDelete.hasNext())
{
QList<AutoProfileInfo*> templist = iterClassDelete.next();
terminateProfiles.unite(templist.toSet());
}
windowClassProfileAssignments.clear();
QListIterator<QList<AutoProfileInfo*> > iterNameDelete(windowNameProfileAssignments.values());
while (iterNameDelete.hasNext())
{
QList<AutoProfileInfo*> templist = iterNameDelete.next();
terminateProfiles.unite(templist.toSet());
}
windowNameProfileAssignments.clear();
QSetIterator<AutoProfileInfo*> iterTerminate(terminateProfiles);
while (iterTerminate.hasNext())
{
AutoProfileInfo *info = iterTerminate.next();
if (info)
{
delete info;
info = 0;
}
}
QListIterator<AutoProfileInfo*> iterDefaultsDelete(defaultProfileAssignments.values());
while (iterDefaultsDelete.hasNext())
{
AutoProfileInfo *info = iterDefaultsDelete.next();
if (info)
{
delete info;
info = 0;
}
}
defaultProfileAssignments.clear();
allDefaultInfo = 0;
guidSet.clear();
}
示例8:
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();
}
示例9:
QSet<QString> QgsPointClusterRenderer::usedAttributes() const
{
QSet<QString> attr = QgsPointDistanceRenderer::usedAttributes();
if ( mClusterSymbol )
attr.unite( mClusterSymbol->usedAttributes() );
return attr;
}
示例10: query
void WordMatchSearchImpl::query(const QString &req, QVector<Service::Item *> *res) const
{
QSet<Service::Item*>* resSet = nullptr;
QStringList words = req.split(' ', QString::SkipEmptyParts);
// Quit if there are no words in query
if (words.empty())
return;
for (QString &w : words)
{
InvertedIndex::const_iterator lb, ub;
lb = std::lower_bound (_invertedIndex.cbegin(), _invertedIndex.cend(), w, CaseInsensitiveCompare());
ub = std::upper_bound (_invertedIndex.cbegin(), _invertedIndex.cend(), w, CaseInsensitiveComparePrefix());
QSet<Service::Item*> tmpSet;
while (lb!=ub)
tmpSet.unite(lb++->second);
if (resSet == nullptr)
resSet = new QSet<Service::Item*>(tmpSet);
else
resSet->intersect(tmpSet);
}
if (resSet != nullptr) {
for (Service::Item *s : *resSet)
res->append(s);
delete resSet;
}
}
示例11:
QSet<QString> QgsSingleSymbolRenderer::usedAttributes( const QgsRenderContext &context ) const
{
QSet<QString> attributes;
if ( mSymbol )
attributes.unite( mSymbol->usedAttributes( context ) );
return attributes;
}
示例12:
QSet<QString> QgsPointDisplacementRenderer::usedAttributes( const QgsRenderContext &context ) const
{
QSet<QString> attr = QgsPointDistanceRenderer::usedAttributes( context );
if ( mCenterSymbol )
attr.unite( mCenterSymbol->usedAttributes( context ) );
return attr;
}
示例13: prepare
bool QgsVectorLayerDiagramProvider::prepare( const QgsRenderContext& context, QSet<QString>& attributeNames )
{
QgsDiagramLayerSettings& s2 = mSettings;
const QgsMapSettings& mapSettings = mEngine->mapSettings();
if ( mapSettings.hasCrsTransformEnabled() )
{
if ( context.coordinateTransform().isValid() )
// this is context for layer rendering - use its CT as it includes correct datum transform
s2.setCoordinateTransform( context.coordinateTransform() );
else
// otherwise fall back to creating our own CT - this one may not have the correct datum transform!
s2.setCoordinateTransform( QgsCoordinateTransform( mLayerCrs, mapSettings.destinationCrs() ) );
}
else
{
s2.setCoordinateTransform( QgsCoordinateTransform() );
}
s2.setRenderer( mDiagRenderer );
//add attributes needed by the diagram renderer
attributeNames.unite( s2.referencedFields( context.expressionContext(), mFields ) );
return true;
}
示例14: foreach
QSet<Core::Id> ServerModeReader::updateCodeModel(CppTools::ProjectPartBuilder &ppBuilder)
{
QSet<Core::Id> languages;
int counter = 0;
foreach (const FileGroup *fg, m_fileGroups) {
++counter;
const QString defineArg
= transform(fg->defines, [](const QString &s) -> QString {
QString result = QString::fromLatin1("#define ") + s;
int assignIndex = result.indexOf('=');
if (assignIndex != -1)
result[assignIndex] = ' ';
return result;
}).join('\n');
const QStringList flags = QtcProcess::splitArgs(fg->compileFlags);
const QStringList includes = transform(fg->includePaths, [](const IncludePath *ip) {
return ip->path.toString();
});
ppBuilder.setProjectFile(fg->target->sourceDirectory.toString());
ppBuilder.setDisplayName(fg->target->name + QString::number(counter));
ppBuilder.setDefines(defineArg.toUtf8());
ppBuilder.setIncludePaths(includes);
ppBuilder.setCFlags(flags);
ppBuilder.setCxxFlags(flags);
languages.unite(QSet<Core::Id>::fromList(ppBuilder.createProjectPartsForFiles(transform(fg->sources, &FileName::toString))));
}
示例15: getDocument
QSet<RPropertyTypeId> RBlockReferenceEntity::getPropertyTypeIds() const {
QSet<RPropertyTypeId> ret;
// TODO: move to RObject?
// add attribute tag / values as properties of the block reference:
const RDocument* doc = getDocument();
if (doc!=NULL) {
QSet<REntity::Id> childIds = doc->queryChildEntities(getId(), RS::EntityAttribute);
QSet<REntity::Id>::iterator it;
for (it=childIds.begin(); it!=childIds.end(); it++) {
REntity::Id childId = *it;
QSharedPointer<REntity> child = doc->queryEntityDirect(childId);
if (child.isNull()) {
continue;
}
QSet<RPropertyTypeId> childProperties = child->getPropertyTypeIds();
QSet<RPropertyTypeId>::iterator it2;
for (it2=childProperties.begin(); it2!=childProperties.end(); it2++) {
RPropertyTypeId pid = *it2;
QPair<QVariant, RPropertyAttributes> p = child->getProperty(pid);
if (p.second.isVisibleToParent()) {
pid.setId(RPropertyTypeId::INVALID_ID);
ret.insert(pid);
//qDebug() << pid.getCustomPropertyTitle() << " / " << pid.getCustomPropertyName();
//qDebug() << p.first.toString();
}
}
}
}
ret.unite(REntity::getPropertyTypeIds());
return ret;
}