本文整理汇总了C++中QStringList::toSet方法的典型用法代码示例。如果您正苦于以下问题:C++ QStringList::toSet方法的具体用法?C++ QStringList::toSet怎么用?C++ QStringList::toSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStringList
的用法示例。
在下文中一共展示了QStringList::toSet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QUndoCommand
NewKeyCommand::NewKeyCommand(TreeViewModel *model, int index, DataContainer *data, bool isBelow, QUndoCommand* parent)
: QUndoCommand(parent)
, m_parentNode(model->model().at(index))
, m_newNode(NULL)
, m_value(data->newValue())
, m_metaData(data->newMetadata())
{
TreeViewModel* parentModel = m_parentNode->getChildren();
kdb::Key newKey = parentModel->createNewKey(m_parentNode->getPath() + "/" + data->newName(), m_value, m_metaData);
QStringList newNameSplit = parentModel->getSplittedKeyname(newKey);
kdb::Key parentKey = m_parentNode->getKey();
if(!parentKey)
parentKey = kdb::Key(m_parentNode->getPath().toStdString(), KEY_END);
QStringList parentNameSplit = parentModel->getSplittedKeyname(parentKey);
//check if the new key is directly below the parent
QSet<QString> diff = newNameSplit.toSet().subtract(parentNameSplit.toSet());
if(diff.count() > 1 || isBelow)
setText("newBranch");
else
setText("newKey");
m_name = cutListAtIndex(newNameSplit, parentNameSplit.count()).first();
parentModel->sink(m_parentNode, newNameSplit, newKey.dup());
m_newNode = m_parentNode->getChildByName(m_name);
parentModel->removeRow(m_parentNode->getChildIndexByName(m_name));
}
示例2: setDetailDefinitionsHint
void QDeclarativeContactFetchHint::setDetailDefinitionsHint(const QStringList& definitionNames)
{
if (definitionNames.toSet() != m_fetchHint.detailDefinitionsHint().toSet()) {
m_fetchHint.setDetailDefinitionsHint(definitionNames);
emit fetchHintChanged();
}
}
示例3: setRelationshipTypesHint
void QDeclarativeContactFetchHint::setRelationshipTypesHint(const QStringList& relationshipTypes)
{
if (relationshipTypes.toSet() != m_fetchHint.relationshipTypesHint().toSet()) {
m_fetchHint.setRelationshipTypesHint(relationshipTypes);
emit fetchHintChanged();
}
}
示例4: QStringListModel
LanguageListModel::LanguageListModel(ModelType type, QObject* parent)
: QStringListModel(parent)
, m_sortModel(new QSortFilterProxyModel(this))
#ifndef NOKDE
, m_systemLangList(new KConfig(QLatin1String("locale/kf5_all_languages"), KConfig::NoGlobals, QStandardPaths::GenericDataLocation))
#endif
{
#ifndef NOKDE
setStringList(m_systemLangList->groupList());
#else
QStringList ll;
QList<QLocale> allLocales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyCountry);
foreach(const QLocale& l, allLocales)
ll.append(l.name());
ll=ll.toSet().toList();
setStringList(ll);
#endif
if (type==WithEmptyLang) insertRows(rowCount(), 1);
#if 0 //KDE5PORT
KIconLoader::global()->addExtraDesktopThemes();
#endif
//qWarning()<<KIconLoader::global()->hasContext(KIconLoader::International);
//qDebug()<<KIconLoader::global()->queryIconsByContext(KIconLoader::NoGroup,KIconLoader::International);
m_sortModel->setSourceModel(this);
m_sortModel->sort(0);
}
示例5: getExtensionsForColors
const QStringList LoadSavePlugin::getExtensionsForColors(const int id)
{
QList<FileFormat>::const_iterator it(findFormat(id));
QList<FileFormat>::const_iterator itEnd(formats.constEnd());
QStringList filterList;
// We know the list is sorted by id, then priority, so we can just take the
// highest priority entry for each ID, and we can start with the first entry
// in the list.
//First, check if we even have any plugins to load with
if (it != itEnd)
{
if ((it->load) && (it->colorReading))
filterList.append(it->fileExtensions);
unsigned int lastID = it->formatId;
++it;
for ( ; it != itEnd ; ++it)
{
// Find the next load/save (as appropriate) plugin for the next format type
if (((it->load) && (it->colorReading)) && (it->formatId > lastID))
{
// And add it to the filter list, since we know it's
// the highest priority because of the sort order.
filterList.append(it->fileExtensions);
lastID = it->formatId;
}
}
}
else
qDebug("%s", tr("No File Loader Plugins Found").toLocal8Bit().data());
// Avoid duplicate entries in the list
QSet<QString> fSet = filterList.toSet();
filterList = fSet.toList();
qSort(filterList);
return filterList;
}
示例6: sender
void
MetaQueryWidget::populateComboBox( QStringList results )
{
QObject* query = sender();
if( !query )
return;
QWeakPointer<KComboBox> combo = m_runningQueries.value(query);
if( combo.isNull() )
return;
// note: adding items seems to reset the edit text, so we have
// to take care of that.
disconnect( combo.data(), 0, this, 0 );
// want the results unique and sorted
const QSet<QString> dataSet = results.toSet();
QStringList dataList = dataSet.toList();
dataList.sort();
combo.data()->addItems( dataList );
KCompletion* comp = combo.data()->completionObject();
comp->setItems( dataList );
// reset the text and re-enable the signal
combo.data()->setEditText( m_filter.value );
connect( combo.data(), SIGNAL(editTextChanged( const QString& ) ),
SLOT(valueChanged(const QString&)) );
}
示例7: init
void CompanionTable::init()
{
QStringList companionList = GetConfigFromLuaState(Sanguosha->getLuaState(), "companion_pairs").toStringList();
foreach (const QString &companions, companionList) {
QStringList ones_others = companions.split("+");
QStringList ones = ones_others.first().split("|");
QStringList others = ones_others.last().split("|");
foreach (const QString &one, ones) {
m_companions[one] += others.toSet();
}
foreach (const QString &other, others) {
m_companions[other] += ones.toSet();
}
}
示例8: test_operator_additiveAssignment
void DataSpecTest::test_operator_additiveAssignment()
{
// Use Case:
// Test for merging two requirements objects.
{
DataSpec d1, d2, d3;
QStringList req;
req << "one" << "two";
d1.addStreamData(req.at(0));
d2.addStreamData(req.at(1));
d3.addStreamData(req.toSet());
d1 += d2;
CPPUNIT_ASSERT(d1 == d3);
}
// Use Case:
// Test for merging two requirements objects in a different order.
{
DataSpec d1, d2, d3;
QStringList req;
req << "one" << "two";
d1.addStreamData(req.at(0));
d2.addStreamData(req.at(1));
d3.addStreamData(req.toSet());
d2 += d1;
CPPUNIT_ASSERT(d2 == d3);
}
// Use Case:
// Test for merging two requirements objects, removing duplicates.
{
DataSpec d, d1, d2;
QSet<QString> req, req1, req2;
req << "one" << "two" << "three";
req1 << "one" << "two";
req2 << "two" << "three";
d.addStreamData(req);
d1.addStreamData(req1);
d2.addStreamData(req2);
d2 += d1;
CPPUNIT_ASSERT(d == d2);
}
}
示例9: isAllowed
virtual bool isAllowed(const QStringList& serviceCaps)
{
//client must have at least service caps;
QSet<QString> sub = serviceCaps.toSet() - clientCaps;;
if (sub.isEmpty())
return true;
else
return false;
}
示例10: variableNames
QStringList QgsExpressionContext::variableNames() const
{
QStringList names;
Q_FOREACH ( const QgsExpressionContextScope* scope, mStack )
{
names << scope->variableNames();
}
return names.toSet().toList();
}
示例11: functionNames
QStringList QgsExpressionContext::functionNames() const
{
QStringList result;
Q_FOREACH ( const QgsExpressionContextScope* scope, mStack )
{
result << scope->functionNames();
}
result = result.toSet().toList();
result.sort();
return result;
}
示例12: setInitialMarkedFiles
void SelectableFilesModel::setInitialMarkedFiles(const QStringList &files)
{
m_files = files.toSet();
m_outOfBaseDirFiles.clear();
QString base = m_baseDir + '/';
foreach (const QString &file, m_files)
if (!file.startsWith(base))
m_outOfBaseDirFiles.append(file);
m_allFiles = false;
}
示例13: setRunners
void RunnerModel::setRunners(const QStringList &runners)
{
if (m_runners.toSet() != runners.toSet()) {
m_runners = runners;
if (m_runnerManager) {
m_runnerManager->setAllowedRunners(runners);
}
emit runnersChanged();
}
}
示例14: copyServerUid
/*!
Returns a key matching messages whose serverUid is a member of \a uids, according to \a cmp.
\sa QMailMessage::copyServerUid()
*/
QMailMessageKey QMailMessageKey::copyServerUid(const QStringList &uids, QMailDataComparator::InclusionComparator cmp)
{
#ifndef USE_ALTERNATE_MAILSTORE_IMPLEMENTATION
if (uids.count() >= IdLookupThreshold) {
// If there are a large number of UIDs, they will be inserted into a temporary table
// with a uniqueness constraint; ensure only unique values are supplied
return QMailMessageKey(uids.toSet().toList(), CopyServerUid, QMailKey::comparator(cmp));
}
#endif
return QMailMessageKey(uids, CopyServerUid, QMailKey::comparator(cmp));
}
示例15: getDeviceCapabilities
bool HAvTransportAdapterPrivate::getDeviceCapabilities(
HClientAction*, const HClientActionOp& op)
{
H_Q(HAvTransportAdapter);
HDeviceCapabilities capabilities;
if (op.returnValue() == UpnpSuccess)
{
const HActionArguments& outArgs = op.outputArguments();
QStringList pmedia = outArgs.value("PlayMedia").toString().split(",");
QStringList rmedia = outArgs.value("RecMedia").toString().split(",");
QStringList rqMode = outArgs.value("RecQualityModes").toString().split(",");
capabilities =
HDeviceCapabilities(pmedia.toSet(), rmedia.toSet(), rqMode.toSet());
}
emit q->getDeviceCapabilitiesCompleted(q, takeOp(op, capabilities));
return false;
}