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


C++ QStringList::toSet方法代码示例

本文整理汇总了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));
}
开发者ID:beku,项目名称:libelektra,代码行数:33,代码来源:newkeycommand.cpp

示例2: setDetailDefinitionsHint

void QDeclarativeContactFetchHint::setDetailDefinitionsHint(const QStringList& definitionNames)
{
    if (definitionNames.toSet() != m_fetchHint.detailDefinitionsHint().toSet()) {
        m_fetchHint.setDetailDefinitionsHint(definitionNames);
        emit fetchHintChanged();
    }
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例3: setRelationshipTypesHint

void QDeclarativeContactFetchHint::setRelationshipTypesHint(const QStringList& relationshipTypes)
{
    if (relationshipTypes.toSet() != m_fetchHint.relationshipTypesHint().toSet()) {
        m_fetchHint.setRelationshipTypesHint(relationshipTypes);
        emit fetchHintChanged();
    }
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例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);
}
开发者ID:KDE,项目名称:lokalize,代码行数:27,代码来源:languagelistmodel.cpp

示例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;
}
开发者ID:luzpaz,项目名称:scribus,代码行数:35,代码来源:loadsaveplugin.cpp

示例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&)) );
}
开发者ID:phalgun,项目名称:amarok-nepomuk,代码行数:29,代码来源:MetaQueryWidget.cpp

示例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();
        }
    }
开发者ID:bigambition,项目名称:QSanguosha-Para-tangjs520-yizhiyongheng,代码行数:17,代码来源:companion-table.cpp

示例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);
    }
}
开发者ID:Error323,项目名称:pelican,代码行数:46,代码来源:DataSpecTest.cpp

示例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;
 }
开发者ID:ionionica,项目名称:qt-mobility,代码行数:9,代码来源:tst_qabstractsecuritysession.cpp

示例10: variableNames

QStringList QgsExpressionContext::variableNames() const
{
  QStringList names;
  Q_FOREACH ( const QgsExpressionContextScope* scope, mStack )
  {
    names << scope->variableNames();
  }
  return names.toSet().toList();
}
开发者ID:luipir,项目名称:QGIS,代码行数:9,代码来源:qgsexpressioncontext.cpp

示例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;
}
开发者ID:luipir,项目名称:QGIS,代码行数:11,代码来源:qgsexpressioncontext.cpp

示例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;
}
开发者ID:hdweiss,项目名称:qt-creator-visualizer,代码行数:11,代码来源:selectablefilesmodel.cpp

示例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();
    }
}
开发者ID:cmacq2,项目名称:plasma-desktop,代码行数:12,代码来源:runnermodel.cpp

示例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));
}
开发者ID:qt-labs,项目名称:messagingframework,代码行数:17,代码来源:qmailmessagekey.cpp

示例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;
}
开发者ID:rickysarraf,项目名称:digikam,代码行数:21,代码来源:havtransport_adapter.cpp


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