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


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

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


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

示例1: removeSelectedEntries

void WidgetDownloads::removeSelectedEntries()
{
   QSet<quint64> downloadIDs;

   QModelIndexList selectedRows = this->ui->tblDownloads->selectionModel()->selectedRows();
   bool allComplete = true;
   for (QListIterator<QModelIndex> i(selectedRows); i.hasNext();)
   {
      const QModelIndex& index = i.next();
      downloadIDs += this->currentDownloadsModel->getDownloadIDs(index).toSet();
      if (!this->currentDownloadsModel->isFileComplete(index))
         allComplete = false;
   }

   if (!downloadIDs.isEmpty())
   {
      if (!allComplete)
      {
         QMessageBox msgBox(this);
         msgBox.setWindowIcon(QIcon(":/icons/ressources/delete.png"));
         msgBox.setWindowTitle(tr("Remove selected downloads"));
         msgBox.setText(tr("Are you sure to remove the selected downloads? There is one or more unfinished download."));
         msgBox.setIcon(QMessageBox::Question);
         msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
         msgBox.setDefaultButton(QMessageBox::Ok);
         if (msgBox.exec() == QMessageBox::Ok)
            this->coreConnection->cancelDownloads(downloadIDs.toList());
      }
      else
         this->coreConnection->cancelDownloads(downloadIDs.toList());
   }
}
开发者ID:PowerKiKi,项目名称:D-LAN,代码行数:32,代码来源:WidgetDownloads.cpp

示例2: setMultiValue

void MultiValuesLineEdit::setMultiValue(QSet<QString> value)
{
    if (value.count() == 0)
    {
        mMultiState = MultiValuesEmpty;
        QLineEdit::setText("");
        setPlaceholder(this, "");
        mCompleterModel->setStringList(QStringList());
    }

    else if (value.count() == 1)
    {
        mMultiState = MultiValuesEmpty;
        QLineEdit::setText(*(value.constBegin()));
        setPlaceholder(this, "");
        mCompleterModel->setStringList(value.toList());
    }

    else
    {
        mMultiState = MultiValuesMulti;
        QLineEdit::setText("");
        setPlaceholder(this, tr("Multiple values"));
        mCompleterModel->setStringList(value.toList());
    }
}
开发者ID:Zefling,项目名称:flacon,代码行数:26,代码来源:controls.cpp

示例3: foreach

void CppModelManagerInterface::ProjectInfo::appendProjectPart(const ProjectPart::Ptr &part)
{
    if (!part)
        return;

    m_projectParts.append(part);

    // Update include paths
    QSet<QString> incs = QSet<QString>::fromList(m_includePaths);
    foreach (const QString &ins, part->includePaths)
        incs.insert(ins);
    m_includePaths = incs.toList();

    // Update framework paths
    QSet<QString> frms = QSet<QString>::fromList(m_frameworkPaths);
    foreach (const QString &frm, part->frameworkPaths)
        frms.insert(frm);
    m_frameworkPaths = frms.toList();

    // Update source files
    QSet<QString> srcs = QSet<QString>::fromList(m_sourceFiles);
    foreach (const ProjectFile &file, part->files)
        srcs.insert(file.path);
    m_sourceFiles = srcs.toList();

    // Update defines
    if (!m_defines.isEmpty())
        m_defines.append('\n');
    m_defines.append(part->defines);
}
开发者ID:ProDataLab,项目名称:qt-creator,代码行数:30,代码来源:cppmodelmanagerinterface.cpp

示例4: qMakePair

QVector< QPair<int,int> > PartCorresponder::distributeVectors(int x, int y)
{
	QSet< QPair<int,int> > result;

	if(x == y && x == 1){
		result << qMakePair(0,0);
		return result.toList().toVector();
	}

	int start_i = 0, start_j = 0;
	int end_i = x-1, end_j = y-1;

	bool isStopI = false, isStopJ = false;

	while( true ){
		result << qMakePair(start_i,start_j) << qMakePair(end_i, end_j);

		if(end_i - start_i < 2) { isStopI = true; }
		if(end_j - start_j < 2) { isStopJ = true; }
		if( isStopI && isStopJ ) break;

		if( !isStopI ){
			start_i++;
			end_i--;
		}

		if( !isStopJ ){
			start_j++;
			end_j--;
		}
	}

	return result.toList().toVector();
}
开发者ID:ialhashim,项目名称:ddtt-dev,代码行数:34,代码来源:PartCorresponder.cpp

示例5: qMakePair

/*!
  Returns the difference between the current checkpoint and the
  previous checkpoint. The first item in the pair is a list containing
  the identifiers of the scripts that were added. The second item in
  the pair is a list containing the identifiers of the scripts that
  were removed.
*/
QPair<QList<qint64>, QList<qint64> > QScriptDebuggerAgent::scriptsDelta() const
{
    Q_D(const QScriptDebuggerAgent);
    QSet<qint64> prevSet = d->previousCheckpointScripts.keys().toSet();
    QSet<qint64> currSet = d->checkpointScripts.keys().toSet();
    QSet<qint64> addedScriptIds = currSet - prevSet;
    QSet<qint64> removedScriptIds = prevSet - currSet;
    return qMakePair(addedScriptIds.toList(), removedScriptIds.toList());
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:16,代码来源:qscriptdebuggeragent.cpp

示例6: findAllLibSsl

static QStringList findAllLibSsl()
{
    QStringList paths;
#  ifdef Q_OS_DARWIN
    paths = QString::fromLatin1(qgetenv("DYLD_LIBRARY_PATH"))
            .split(QLatin1Char(':'), QString::SkipEmptyParts);
#  else
    paths = QString::fromLatin1(qgetenv("LD_LIBRARY_PATH"))
            .split(QLatin1Char(':'), QString::SkipEmptyParts);
#  endif
    paths << QLatin1String("/lib") << QLatin1String("/usr/lib") << QLatin1String("/usr/local/lib");
#ifdef Q_OS_LINUX
    // discover paths of already loaded libraries
    QSet<QString> loadedPaths;
    dl_iterate_phdr(dlIterateCallback, &loadedPaths);
    paths.append(loadedPaths.toList());
#endif

    QStringList foundSsls;
    foreach (const QString &path, paths) {
        QDir dir = QDir(path);
        QStringList entryList = dir.entryList(QStringList() << QLatin1String("libssl.*"), QDir::Files);

        qSort(entryList.begin(), entryList.end(), libGreaterThan);
        foreach (const QString &entry, entryList)
            foundSsls << path + QLatin1Char('/') + entry;
    }
开发者ID:RS102839,项目名称:qt,代码行数:27,代码来源:qsslsocket_openssl_symbols.cpp

示例7: sceneChanged

void GroupSelWidget::sceneChanged()
{
    QSet<QString> groupSet = _scene->getAllGroups();
    if(groupSet == _prevGroupSet)
        return;
    _prevGroupSet = groupSet;

    QList<QString> groups = groupSet.toList();
    qSort(groups);

    for(int i = 0; i < (int)_checkBoxes.size(); ++i)
        delete _checkBoxes[i];
    _checkBoxes.clear();

    int childWidth = 0;
    for(int i = 0; i < (int)groups.size(); ++i) {
        QCheckBox *box =  new QCheckBox(groups[i], this);
        QFont font = box->font();
        font.setPointSize(14);
        box->setFont(font);
        box->setCheckState(_scene->isGroupVisible(groups[i]) ? Qt::Checked : Qt::Unchecked);
        new VisibilitySetter(box, _scene, groups[i]);
        layout()->addWidget(box);
        childWidth = max(childWidth, box->sizeHint().width());
        _checkBoxes.push_back(box);
    }

    setMinimumWidth(150);

    QWidget *scrollArea = parentWidget()->parentWidget()->parentWidget();
    scrollArea->setMinimumWidth(childWidth + 20);
}
开发者ID:F2X,项目名称:cornucopia-lib,代码行数:32,代码来源:GroupSelWidget.cpp

示例8: handleUsers

void VkAccount::handleUsers (const QList<UserInfo>& infos)
{
    QList<QObject*> newEntries;
    QSet<int> newCountries;
    bool hadNew = false;
    for (const auto& info : infos)
    {
        if (Entries_.contains (info.ID_))
        {
            Entries_ [info.ID_]->UpdateInfo (info);
            continue;
        }

        auto entry = new VkEntry (info, this);
        Entries_ [info.ID_] = entry;
        newEntries << entry;

        newCountries << info.Country_;

        hadNew = true;
    }

    GeoResolver_->CacheCountries (newCountries.toList ());

    if (!newEntries.isEmpty ())
        emit gotCLItems (newEntries);

    if (hadNew)
        TryPendingMessages ();
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例9: populateMenu

void populateMenu(QSet<ActionInterface* > &actionInterfaces,
                  const QByteArray &category,
                  QMenu* menu,
                  const SelectionContext &selectionContext)
{
    QSet<ActionInterface* > matchingFactories = findMembers(actionInterfaces, category);

    actionInterfaces.subtract(matchingFactories);

    QList<ActionInterface* > matchingFactoriesList = matchingFactories.toList();
    Utils::sort(matchingFactoriesList, [](ActionInterface *l, ActionInterface *r) {
        return l->priority() > r->priority();
    });

    foreach (ActionInterface* actionInterface, matchingFactoriesList) {
        if (actionInterface->type() == ActionInterface::ContextMenu) {
            actionInterface->currentContextChanged(selectionContext);
            QMenu *newMenu = actionInterface->action()->menu();
            if (newMenu && !newMenu->title().isEmpty())
                menu->addMenu(newMenu);

            //recurse

            populateMenu(actionInterfaces, actionInterface->menuId(), newMenu, selectionContext);
       } else if (actionInterface->type() == ActionInterface::ContextMenuAction
                  || actionInterface->type() == ActionInterface::Action) {
           QAction* action = actionInterface->action();
           actionInterface->currentContextChanged(selectionContext);
           action->setIconVisibleInMenu(false);
           menu->addAction(action);
       }
    }
}
开发者ID:qtproject,项目名称:qt-creator,代码行数:33,代码来源:modelnodecontextmenu.cpp

示例10:

QList<RssFeed*> QRssDisplayModel::SelectedFeeds()
{
	QSet<RssFeed*> res;
	QModelIndexList selectedIndexes = m_pItemsView->selectionModel()->selectedIndexes();

	for (int i = 0 ; i < selectedIndexes.size(); i++)
	{
		QModelIndex selectedIndex = selectedIndexes[i];

		if (selectedIndex.isValid())
		{
			QVariant data = selectedIndex.data(RssFeedRole);

			if (data.isValid())
			{
				RssFeed* pFeed = data.value<RssFeed*>();
				res.insert(pFeed);
			}
			else
			{
				data = selectedIndex.data(RssItemRole);

				if (data.isValid())
				{
					RssItem* pItem = data.value<RssItem*>();
					res.insert(pItem->rssFeed());
				}
			}
		}
	}

	return res.toList();
}
开发者ID:sunpeng196,项目名称:CuteTorrent,代码行数:33,代码来源:QRssDisplayModel.cpp

示例11: libraryPathList

static QStringList libraryPathList()
{
    QStringList paths;
#  ifdef Q_OS_DARWIN
    paths = QString::fromLatin1(qgetenv("DYLD_LIBRARY_PATH"))
            .split(QLatin1Char(':'), QString::SkipEmptyParts);
#  else
    paths = QString::fromLatin1(qgetenv("LD_LIBRARY_PATH"))
            .split(QLatin1Char(':'), QString::SkipEmptyParts);
#  endif
    paths << QLatin1String("/lib") << QLatin1String("/usr/lib") << QLatin1String("/usr/local/lib");
    paths << QLatin1String("/lib64") << QLatin1String("/usr/lib64") << QLatin1String("/usr/local/lib64");
    paths << QLatin1String("/lib32") << QLatin1String("/usr/lib32") << QLatin1String("/usr/local/lib32");

#if defined(Q_OS_ANDROID_NO_SDK)
    paths << QLatin1String("/system/lib");
#elif defined(Q_OS_LINUX)
    // discover paths of already loaded libraries
    QSet<QString> loadedPaths;
    dl_iterate_phdr(dlIterateCallback, &loadedPaths);
    paths.append(loadedPaths.toList());
#endif

    return paths;
}
开发者ID:FlavioFalcao,项目名称:qt5,代码行数:25,代码来源:qsslsocket_openssl_symbols.cpp

示例12: createProposal

static void createProposal(QFutureInterface<QStringList> &future, const QString &text,
                           const QString &wordUnderCursor)
{
    const QRegularExpression wordRE("([a-zA-Z_][a-zA-Z0-9_]{2,})");

    QSet<QString> words;
    QRegularExpressionMatchIterator it = wordRE.globalMatch(text);
    int wordUnderCursorFound = 0;
    while (it.hasNext()) {
        if (future.isCanceled())
            return;
        QRegularExpressionMatch match = it.next();
        const QString &word = match.captured();
        if (word == wordUnderCursor) {
            // Only add the word under cursor if it
            // already appears elsewhere in the text
            if (++wordUnderCursorFound < 2)
                continue;
        }

        if (!words.contains(word))
            words.insert(word);
    }

    future.reportResult(words.toList());
}
开发者ID:kai66673,项目名称:qt-creator,代码行数:26,代码来源:documentcontentcompletion.cpp

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

示例14: onDisplayChangeEvent

void MScenePrivate::onDisplayChangeEvent(MOnDisplayChangeEvent *event)
{
    Q_Q(MScene);

    if (event->state() == MOnDisplayChangeEvent::FullyOnDisplay ||
            event->state() == MOnDisplayChangeEvent::FullyOffDisplay) {
        // Simple cases. Just forward the event as it is.
        sendEventToMWidgets(filterMWidgets(q->items()), event);
        return;
    }

    QList<MWidget *> fullyOnWidgets;
    QList<MWidget *> partiallyOnWidgets;
    QList<MWidget *> fullyOffWidgets;

    QList<MWidget *> intersectingWidgets = filterMWidgets(q->items(event->viewRect(),
            Qt::IntersectsItemBoundingRect));

    QList<MWidget *> allWidgets = filterMWidgets(q->items());

    // Find who is fully on, partially on and fully off

    QSet<MWidget *> fullyOffWidgetsSet = allWidgets.toSet().subtract(intersectingWidgets.toSet());
    fullyOffWidgets = fullyOffWidgetsSet.toList();

    int intersectingWidgetsCount = intersectingWidgets.count();
    MWidget *widget;
    for (int i = 0; i < intersectingWidgetsCount; i++) {
        widget = intersectingWidgets.at(i);
        if (event->viewRect().contains(widget->sceneBoundingRect())) {
            fullyOnWidgets << widget;
        } else {
            partiallyOnWidgets << widget;
        }
    }

    // Send the events to the corresponding MWidgets

    if (fullyOnWidgets.count() > 0) {
        MOnDisplayChangeEvent fullyOnEvent(MOnDisplayChangeEvent::FullyOnDisplay,
                                             event->viewRect());

        sendEventToMWidgets(fullyOnWidgets, &fullyOnEvent);
    }

    if (fullyOffWidgets.count() > 0) {
        MOnDisplayChangeEvent fullyOffEvent(MOnDisplayChangeEvent::FullyOffDisplay,
                                              event->viewRect());

        sendEventToMWidgets(fullyOffWidgets, &fullyOffEvent);
    }

    if (partiallyOnWidgets.count() > 0) {
        MOnDisplayChangeEvent partiallyOnEvent(MOnDisplayChangeEvent::PartiallyOnDisplay,
                event->viewRect());

        sendEventToMWidgets(partiallyOnWidgets, &partiallyOnEvent);
    }

}
开发者ID:dudochkin-victor,项目名称:libgogootouch,代码行数:60,代码来源:mscene.cpp

示例15: cleanupTags

QStringList MetadataHub::cleanupTags(const QStringList& toClean)
{
    QSet<QString> deduplicator;

    for (int index = 0; index < toClean.size(); index++)
    {
        QString keyword = toClean.at(index);

        if (!keyword.isEmpty())
        {

            // _Digikam_root_tag_ is present in some photos tagged with older
            // version of digiKam, must be removed
            if (keyword.contains(QRegExp(QLatin1String("(_Digikam_root_tag_/|/_Digikam_root_tag_|_Digikam_root_tag_)"))))
            {
                keyword = keyword.replace(QRegExp(QLatin1String("(_Digikam_root_tag_/|/_Digikam_root_tag_|_Digikam_root_tag_)")),
                                          QLatin1String(""));
            }

            deduplicator.insert(keyword);
        }
    }

    return deduplicator.toList();
}
开发者ID:,项目名称:,代码行数:25,代码来源:


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