More Utils::toSet/toList

... and unrelated cosmetic changes.

Change-Id: I591b17fd5289831e701b683f8fb47816efd1fa67
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-07-03 18:34:30 +02:00
parent 599b03179e
commit 6a58666f44
49 changed files with 138 additions and 105 deletions

View File

@@ -67,6 +67,8 @@
#include <tokencommand.h> #include <tokencommand.h>
#include <removesharedmemorycommand.h> #include <removesharedmemorycommand.h>
#include <utils/algorithm.h>
#include <QDebug> #include <QDebug>
#include <QQmlEngine> #include <QQmlEngine>
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
@@ -88,7 +90,10 @@
#include <algorithm> #include <algorithm>
namespace { namespace {
bool testImportStatements(const QStringList &importStatementList, const QUrl &url, QString *errorMessage = 0) {
bool testImportStatements(const QStringList &importStatementList,
const QUrl &url, QString *errorMessage = nullptr)
{
if (importStatementList.isEmpty()) if (importStatementList.isEmpty())
return false; return false;
// ToDo: move engine outside of this function, this makes it expensive // ToDo: move engine outside of this function, this makes it expensive
@@ -455,7 +460,7 @@ void NodeInstanceServer::setupImports(const QVector<AddImportContainer> &contain
delete m_importComponent.data(); delete m_importComponent.data();
delete m_importComponentObject.data(); delete m_importComponentObject.data();
const QStringList importStatementList(importStatementSet.toList()); const QStringList importStatementList = Utils::toList(importStatementSet);
const QStringList fullImportStatementList(QStringList(qtQuickImport) + importStatementList); const QStringList fullImportStatementList(QStringList(qtQuickImport) + importStatementList);
// check possible import statements combinations // check possible import statements combinations

View File

@@ -60,6 +60,8 @@
#include <designersupportdelegate.h> #include <designersupportdelegate.h>
#include <utils/algorithm.h>
namespace QmlDesigner { namespace QmlDesigner {
Qt5InformationNodeInstanceServer::Qt5InformationNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient) : Qt5InformationNodeInstanceServer::Qt5InformationNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient) :
@@ -166,13 +168,14 @@ void Qt5InformationNodeInstanceServer::collectItemChangesAndSendChangeCommands()
sendTokenBack(); sendTokenBack();
if (!informationChangedInstanceSet.isEmpty()) if (!informationChangedInstanceSet.isEmpty())
nodeInstanceClient()->informationChanged(createAllInformationChangedCommand(informationChangedInstanceSet.toList())); nodeInstanceClient()->informationChanged(
createAllInformationChangedCommand(Utils::toList(informationChangedInstanceSet)));
if (!propertyChangedList.isEmpty()) if (!propertyChangedList.isEmpty())
nodeInstanceClient()->valuesChanged(createValuesChangedCommand(propertyChangedList)); nodeInstanceClient()->valuesChanged(createValuesChangedCommand(propertyChangedList));
if (!m_parentChangedSet.isEmpty()) { if (!m_parentChangedSet.isEmpty()) {
sendChildrenChangedCommand(m_parentChangedSet.toList()); sendChildrenChangedCommand(Utils::toList(m_parentChangedSet));
m_parentChangedSet.clear(); m_parentChangedSet.clear();
} }

View File

@@ -60,6 +60,8 @@
#include <designersupportdelegate.h> #include <designersupportdelegate.h>
#include <utils/algorithm.h>
namespace QmlDesigner { namespace QmlDesigner {
Qt5RenderNodeInstanceServer::Qt5RenderNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient) : Qt5RenderNodeInstanceServer::Qt5RenderNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient) :
@@ -94,7 +96,7 @@ void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands()
clearChangedPropertyList(); clearChangedPropertyList();
if (!m_dirtyInstanceSet.isEmpty()) { if (!m_dirtyInstanceSet.isEmpty()) {
nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand(m_dirtyInstanceSet.toList())); nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand(Utils::toList(m_dirtyInstanceSet)));
m_dirtyInstanceSet.clear(); m_dirtyInstanceSet.clear();
} }

View File

@@ -62,6 +62,8 @@
#include <designersupportdelegate.h> #include <designersupportdelegate.h>
#include <utils/algorithm.h>
namespace QmlDesigner { namespace QmlDesigner {
Qt5TestNodeInstanceServer::Qt5TestNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient) Qt5TestNodeInstanceServer::Qt5TestNodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient)
@@ -288,7 +290,8 @@ void QmlDesigner::Qt5TestNodeInstanceServer::collectItemChangesAndSendChangeComm
clearChangedPropertyList(); clearChangedPropertyList();
if (!informationChangedInstanceSet.isEmpty()) { if (!informationChangedInstanceSet.isEmpty()) {
InformationChangedCommand command = createAllInformationChangedCommand(informationChangedInstanceSet.toList()); InformationChangedCommand command
= createAllInformationChangedCommand(Utils::toList(informationChangedInstanceSet));
command.sort(); command.sort();
nodeInstanceClient()->informationChanged(command); nodeInstanceClient()->informationChanged(command);
} }
@@ -299,7 +302,7 @@ void QmlDesigner::Qt5TestNodeInstanceServer::collectItemChangesAndSendChangeComm
} }
if (!parentChangedSet.isEmpty()) if (!parentChangedSet.isEmpty())
sendChildrenChangedCommand(parentChangedSet.toList()); sendChildrenChangedCommand(Utils::toList(parentChangedSet));
} }
} }

View File

@@ -37,6 +37,8 @@
#include <cplusplus/Scope.h> #include <cplusplus/Scope.h>
#include <cplusplus/Control.h> #include <cplusplus/Control.h>
#include <utils/algorithm.h>
#include <QStack> #include <QStack>
#include <QHash> #include <QHash>
#include <QVarLengthArray> #include <QVarLengthArray>
@@ -1175,7 +1177,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
if (!name->isTemplateNameId()) if (!name->isTemplateNameId())
_alreadyConsideredClasses.insert(referenceClass); _alreadyConsideredClasses.insert(referenceClass);
QSet<ClassOrNamespace *> knownUsings = reference->usings().toSet(); QSet<ClassOrNamespace *> knownUsings = Utils::toSet(reference->usings());
// If we are dealling with a template type, more work is required, since we need to // If we are dealling with a template type, more work is required, since we need to
// construct all instantiation data. // construct all instantiation data.

View File

@@ -50,6 +50,8 @@
#include "qmt/tasks/diagramscenecontroller.h" #include "qmt/tasks/diagramscenecontroller.h"
#include "qmt/tasks/ielementtasks.h" #include "qmt/tasks/ielementtasks.h"
#include <utils/algorithm.h>
#include <QSet> #include <QSet>
#include <QGraphicsItem> #include <QGraphicsItem>
#include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneMouseEvent>
@@ -514,8 +516,8 @@ bool DiagramSceneModel::exportSvg(const QString &fileName, bool selectedElements
return true; return true;
#else // QT_NO_SVG #else // QT_NO_SVG
Q_UNUSED(fileName); Q_UNUSED(fileName)
Q_UNUSED(selectedElements); Q_UNUSED(selectedElements)
return false; return false;
#endif // QT_NO_SVG #endif // QT_NO_SVG
} }
@@ -639,7 +641,7 @@ void DiagramSceneModel::keyReleaseEvent(QKeyEvent *event)
void DiagramSceneModel::mousePressEvent(QGraphicsSceneMouseEvent *event) void DiagramSceneModel::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
updateFocusItem(QSet<QGraphicsItem *>::fromList(m_graphicsScene->selectedItems())); updateFocusItem(Utils::toSet(m_graphicsScene->selectedItems()));
m_latchController->mousePressEventLatching(event); m_latchController->mousePressEventLatching(event);
mousePressEventReparenting(event); mousePressEventReparenting(event);
} }
@@ -681,7 +683,7 @@ void DiagramSceneModel::mouseReleaseEventReparenting(QGraphicsSceneMouseEvent *e
if (event->modifiers() & Qt::AltModifier) { if (event->modifiers() & Qt::AltModifier) {
ModelController *modelController = diagramController()->modelController(); ModelController *modelController = diagramController()->modelController();
MPackage *newOwner = nullptr; MPackage *newOwner = nullptr;
QSet<QGraphicsItem *> selectedItemSet = m_graphicsScene->selectedItems().toSet(); QSet<QGraphicsItem *> selectedItemSet = Utils::toSet(m_graphicsScene->selectedItems());
QList<QGraphicsItem *> itemsUnderMouse = m_graphicsScene->items(event->scenePos()); QList<QGraphicsItem *> itemsUnderMouse = m_graphicsScene->items(event->scenePos());
foreach (QGraphicsItem *item, itemsUnderMouse) { foreach (QGraphicsItem *item, itemsUnderMouse) {
if (!selectedItemSet.contains(item)) { if (!selectedItemSet.contains(item)) {
@@ -840,7 +842,7 @@ void DiagramSceneModel::onSelectionChanged()
bool selectionChanged = false; bool selectionChanged = false;
// collect and update all primary selected items (selected by user) // collect and update all primary selected items (selected by user)
QSet<QGraphicsItem *> newSelectedItems = QSet<QGraphicsItem *>::fromList(m_graphicsScene->selectedItems()); QSet<QGraphicsItem *> newSelectedItems = Utils::toSet(m_graphicsScene->selectedItems());
updateFocusItem(newSelectedItems); updateFocusItem(newSelectedItems);
foreach (QGraphicsItem *item, m_selectedItems) { foreach (QGraphicsItem *item, m_selectedItems) {
if (!newSelectedItems.contains(item)) { if (!newSelectedItems.contains(item)) {

View File

@@ -29,6 +29,7 @@
#include "qmljsutils.h" #include "qmljsutils.h"
#include "parser/qmljsast_p.h" #include "parser/qmljsast_p.h"
#include <utils/algorithm.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QColor> #include <QColor>
@@ -666,7 +667,7 @@ Check::Check(Document::Ptr doc, const ContextPtr &context)
_isQtQuick2 = isQtQuick2(); _isQtQuick2 = isQtQuick2();
} }
_enabledMessages = Message::allMessageTypes().toSet(); _enabledMessages = Utils::toSet(Message::allMessageTypes());
disableMessage(HintAnonymousFunctionSpacing); disableMessage(HintAnonymousFunctionSpacing);
disableMessage(HintDeclareVarsInOneLine); disableMessage(HintDeclareVarsInOneLine);
disableMessage(HintDeclarationsShouldBeAtStartOfFunction); disableMessage(HintDeclarationsShouldBeAtStartOfFunction);
@@ -1539,7 +1540,7 @@ void Check::scanCommentsForAnnotations()
// enable all checks annotation // enable all checks annotation
if (comment.contains("@enable-all-checks")) if (comment.contains("@enable-all-checks"))
_enabledMessages = Message::allMessageTypes().toSet(); _enabledMessages = Utils::toSet(Message::allMessageTypes());
// find all disable annotations // find all disable annotations
int lastOffset = -1; int lastOffset = -1;

View File

@@ -27,6 +27,7 @@
#include "qmljsinterpreter.h" #include "qmljsinterpreter.h"
#include "qmljsviewercontext.h" #include "qmljsviewercontext.h"
#include <utils/algorithm.h>
#include <utils/qrcparser.h> #include <utils/qrcparser.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -521,7 +522,7 @@ QByteArray DependencyInfo::calculateFingerprint(const ImportDependencies &deps)
{ {
QCryptographicHash hash(QCryptographicHash::Sha1); QCryptographicHash hash(QCryptographicHash::Sha1);
rootImport.addToHash(hash); rootImport.addToHash(hash);
QStringList coreImports = allCoreImports.toList(); QStringList coreImports = Utils::toList(allCoreImports);
coreImports.sort(); coreImports.sort();
foreach (const QString importId, coreImports) { foreach (const QString importId, coreImports) {
hash.addData(reinterpret_cast<const char*>(importId.constData()), importId.size() * sizeof(QChar)); hash.addData(reinterpret_cast<const char*>(importId.constData()), importId.size() * sizeof(QChar));
@@ -529,9 +530,9 @@ QByteArray DependencyInfo::calculateFingerprint(const ImportDependencies &deps)
hash.addData(coreImportFingerprint); hash.addData(coreImportFingerprint);
} }
hash.addData("/", 1); hash.addData("/", 1);
QList<ImportKey> imports(allImports.toList()); QList<ImportKey> imports = Utils::toList(allImports);
std::sort(imports.begin(), imports.end()); std::sort(imports.begin(), imports.end());
foreach (const ImportKey &k, imports) for (const ImportKey &k : qAsConst(imports))
k.addToHash(hash); k.addToHash(hash);
return hash.result(); return hash.result();
} }

View File

@@ -82,15 +82,15 @@ static QStringList qtSoPaths(QtSupport::BaseQtVersion *qtVersion)
paths.insert(it.fileInfo().absolutePath()); paths.insert(it.fileInfo().absolutePath());
} }
} }
return paths.toList(); return Utils::toList(paths);
} }
static QStringList uniquePaths(const QStringList &files) static QStringList uniquePaths(const QStringList &files)
{ {
QSet<QString> paths; QSet<QString> paths;
foreach (const QString &file, files) for (const QString &file : files)
paths<<QFileInfo(file).absolutePath(); paths << QFileInfo(file).absolutePath();
return paths.toList(); return Utils::toList(paths);
} }
static QStringList getSoLibSearchPath(const ProjectNode *node) static QStringList getSoLibSearchPath(const ProjectNode *node)

View File

@@ -306,7 +306,7 @@ void AndroidSdkModel::selectMissingEssentials()
QList<const AndroidSdkPackage *> AndroidSdkModel::userSelection() const QList<const AndroidSdkPackage *> AndroidSdkModel::userSelection() const
{ {
return m_changeState.toList(); return Utils::toList(m_changeState);
} }
void AndroidSdkModel::resetSelection() void AndroidSdkModel::resetSelection()

View File

@@ -239,7 +239,7 @@ static void fetchAndMergeBaseTestFunctions(const QSet<QString> &baseClasses,
const CPlusPlus::Document::Ptr &doc, const CPlusPlus::Document::Ptr &doc,
const CPlusPlus::Snapshot &snapshot) const CPlusPlus::Snapshot &snapshot)
{ {
QList<QString> bases = baseClasses.toList(); QList<QString> bases = Utils::toList(baseClasses);
while (!bases.empty()) { while (!bases.empty()) {
const QString base = bases.takeFirst(); const QString base = bases.takeFirst();
TestVisitor baseVisitor(base, snapshot); TestVisitor baseVisitor(base, snapshot);
@@ -250,7 +250,7 @@ static void fetchAndMergeBaseTestFunctions(const QSet<QString> &baseClasses,
baseVisitor.accept(declaringDoc->globalNamespace()); baseVisitor.accept(declaringDoc->globalNamespace());
if (!baseVisitor.resultValid()) if (!baseVisitor.resultValid())
continue; continue;
bases.append(baseVisitor.baseClasses().toList()); bases.append(Utils::toList(baseVisitor.baseClasses()));
mergeTestFunctions(testFunctions, baseVisitor.privateSlots()); mergeTestFunctions(testFunctions, baseVisitor.privateSlots());
} }
} }

View File

@@ -130,7 +130,8 @@ void QtCreatorClangQueryFindFilter::prepareFind()
const CppTools::ProjectInfo projectInfo = CppTools::CppModelManager::instance()->projectInfo(currentProject); const CppTools::ProjectInfo projectInfo = CppTools::CppModelManager::instance()->projectInfo(currentProject);
setProjectParts(projectInfo.projectParts().toStdVector()); const QVector<CppTools::ProjectPart::Ptr> parts = projectInfo.projectParts();
setProjectParts({parts.begin(), parts.end()});
setUnsavedContent(createUnsavedContents()); setUnsavedContent(createUnsavedContents());
} }

View File

@@ -128,10 +128,10 @@ void ClangToolsProjectSettings::store()
m_project->setNamedSettings(SETTINGS_KEY_DIAGNOSTIC_CONFIG, m_diagnosticConfig.toSetting()); m_project->setNamedSettings(SETTINGS_KEY_DIAGNOSTIC_CONFIG, m_diagnosticConfig.toSetting());
m_project->setNamedSettings(SETTINGS_KEY_BUILD_BEFORE_ANALYSIS, m_buildBeforeAnalysis); m_project->setNamedSettings(SETTINGS_KEY_BUILD_BEFORE_ANALYSIS, m_buildBeforeAnalysis);
const QStringList dirs = Utils::transform(m_selectedDirs.toList(), &Utils::FilePath::toString); const QStringList dirs = Utils::transform<QList>(m_selectedDirs, &Utils::FilePath::toString);
m_project->setNamedSettings(SETTINGS_KEY_SELECTED_DIRS, dirs); m_project->setNamedSettings(SETTINGS_KEY_SELECTED_DIRS, dirs);
const QStringList files = Utils::transform(m_selectedFiles.toList(), &Utils::FilePath::toString); const QStringList files = Utils::transform<QList>(m_selectedFiles, &Utils::FilePath::toString);
m_project->setNamedSettings(SETTINGS_KEY_SELECTED_FILES, files); m_project->setNamedSettings(SETTINGS_KEY_SELECTED_FILES, files);
QVariantList list; QVariantList list;

View File

@@ -587,8 +587,7 @@ void Parser::clearCache()
void Parser::setFileList(const QStringList &fileList) void Parser::setFileList(const QStringList &fileList)
{ {
d->fileList.clear(); d->fileList = ::Utils::toSet(fileList);
d->fileList = QSet<QString>::fromList(fileList);
} }
/*! /*!

View File

@@ -294,7 +294,7 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc)
{ {
CMakeConfigItem paths; CMakeConfigItem paths;
paths.key = "ANDROID_SO_LIBS_PATHS"; paths.key = "ANDROID_SO_LIBS_PATHS";
paths.values = res.toList(); paths.values = Utils::toList(res);
patchedConfig.append(paths); patchedConfig.append(paths);
} }

View File

@@ -297,7 +297,7 @@ void TeaLeafReader::generateProjectTree(CMakeProjectNode *root, const QList<cons
= Utils::filtered(bt.includeFiles, [this](const Utils::FilePath &fn) { = Utils::filtered(bt.includeFiles, [this](const Utils::FilePath &fn) {
return fn.isChildOf(m_parameters.sourceDirectory); return fn.isChildOf(m_parameters.sourceDirectory);
}); });
allIncludePathSet.unite(QSet<FilePath>::fromList(targetIncludePaths)); allIncludePathSet.unite(Utils::toSet(targetIncludePaths));
} }
const QList<FilePath> allIncludePaths = allIncludePathSet.toList(); const QList<FilePath> allIncludePaths = allIncludePathSet.toList();

View File

@@ -382,7 +382,7 @@ static void onReplaceUsagesClicked(const QString &text,
const QStringList fileNames = TextEditor::BaseFileFind::replaceAll(text, items, preserveCase); const QStringList fileNames = TextEditor::BaseFileFind::replaceAll(text, items, preserveCase);
if (!fileNames.isEmpty()) { if (!fileNames.isEmpty()) {
modelManager->updateSourceFiles(fileNames.toSet()); modelManager->updateSourceFiles(Utils::toSet(fileNames));
SearchResultWindow::instance()->hide(); SearchResultWindow::instance()->hide();
} }
} }

View File

@@ -36,6 +36,8 @@
#include <cplusplus/CppRewriter.h> #include <cplusplus/CppRewriter.h>
#include <cplusplus/Overview.h> #include <cplusplus/Overview.h>
#include <utils/algorithm.h>
#include <utils/changeset.h> #include <utils/changeset.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/utilsicons.h> #include <utils/utilsicons.h>
@@ -1086,11 +1088,11 @@ void InsertVirtualMethodsDialog::saveSettings()
m_settings->overrideReplacementIndex = m_overrideReplacementComboBox->currentIndex(); m_settings->overrideReplacementIndex = m_overrideReplacementComboBox->currentIndex();
if (m_overrideReplacementComboBox && m_overrideReplacementComboBox->isEnabled()) if (m_overrideReplacementComboBox && m_overrideReplacementComboBox->isEnabled())
m_settings->overrideReplacement = m_overrideReplacementComboBox->currentText().trimmed(); m_settings->overrideReplacement = m_overrideReplacementComboBox->currentText().trimmed();
QSet<QString> addedReplacements = m_availableOverrideReplacements.toSet(); QSet<QString> addedReplacements = Utils::toSet(m_availableOverrideReplacements);
addedReplacements.insert(m_settings->overrideReplacement); addedReplacements.insert(m_settings->overrideReplacement);
addedReplacements.subtract(defaultOverrideReplacements().toSet()); addedReplacements.subtract(Utils::toSet(defaultOverrideReplacements()));
m_settings->userAddedOverrideReplacements = m_settings->userAddedOverrideReplacements =
sortedAndTrimmedStringListWithoutEmptyElements(addedReplacements.toList()); sortedAndTrimmedStringListWithoutEmptyElements(Utils::toList(addedReplacements));
m_settings->write(); m_settings->write();
} }

View File

@@ -29,6 +29,7 @@
#include <projectexplorer/projectmacro.h> #include <projectexplorer/projectmacro.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <utils/algorithm.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
using namespace CPlusPlus; using namespace CPlusPlus;
@@ -269,7 +270,7 @@ void BuiltinEditorDocumentParser::addFileAndDependencies(Snapshot *snapshot,
toRemove->insert(fileName); toRemove->insert(fileName);
if (fileName != Utils::FilePath::fromString(filePath())) { if (fileName != Utils::FilePath::fromString(filePath())) {
Utils::FilePathList deps = snapshot->filesDependingOn(fileName); Utils::FilePathList deps = snapshot->filesDependingOn(fileName);
toRemove->unite(QSet<Utils::FilePath>::fromList(deps)); toRemove->unite(Utils::toSet(deps));
} }
} }

View File

@@ -197,7 +197,7 @@ void index(QFutureInterface<void> &indexingFuture,
const int sourceCount = sources.size(); const int sourceCount = sources.size();
QStringList files = sources + headers; QStringList files = sources + headers;
sourceProcessor->setTodo(files.toSet()); sourceProcessor->setTodo(Utils::toSet(files));
const QString conf = CppModelManager::configurationFileName(); const QString conf = CppModelManager::configurationFileName();
bool processingHeaders = false; bool processingHeaders = false;

View File

@@ -381,7 +381,7 @@ private:
levelNode->childDirectories.append(checkNode); levelNode->childDirectories.append(checkNode);
m_topics.unite(check.topics.toSet()); m_topics.unite(Utils::toSet(check.topics));
} }
} }
@@ -1003,7 +1003,7 @@ void ClangDiagnosticConfigsWidget::setupTabs()
setupTreeView(m_clazyChecks->checksView, m_clazySortFilterProxyModel, 2); setupTreeView(m_clazyChecks->checksView, m_clazySortFilterProxyModel, 2);
m_clazyChecks->checksView->setSortingEnabled(true); m_clazyChecks->checksView->setSortingEnabled(true);
m_clazyChecks->checksView->sortByColumn(0, Qt::AscendingOrder); m_clazyChecks->checksView->sortByColumn(0, Qt::AscendingOrder);
auto topicsModel = new QStringListModel(m_clazyTreeModel->topics().toList(), this); auto topicsModel = new QStringListModel(Utils::toList(m_clazyTreeModel->topics()), this);
topicsModel->sort(0); topicsModel->sort(0);
m_clazyChecks->topicsView->setModel(topicsModel); m_clazyChecks->topicsView->setModel(topicsModel);
connect(m_clazyChecks->topicsResetButton, &QPushButton::clicked, [this](){ connect(m_clazyChecks->topicsResetButton, &QPushButton::clicked, [this](){

View File

@@ -388,7 +388,7 @@ void CppToolsPlugin::test_global_completion()
QVERIFY(test.succeededSoFar()); QVERIFY(test.succeededSoFar());
const QStringList completions = test.getCompletions(); const QStringList completions = test.getCompletions();
QVERIFY(isProbablyGlobalCompletion(completions)); QVERIFY(isProbablyGlobalCompletion(completions));
QVERIFY(completions.toSet().contains(requiredCompletionItems.toSet())); QVERIFY(Utils::toSet(completions).contains(Utils::toSet(requiredCompletionItems)));
} }
void CppToolsPlugin::test_doxygen_tag_completion_data() void CppToolsPlugin::test_doxygen_tag_completion_data()

View File

@@ -402,7 +402,7 @@ void CppFindReferences::onReplaceButtonClicked(const QString &text,
{ {
const QStringList fileNames = TextEditor::BaseFileFind::replaceAll(text, items, preserveCase); const QStringList fileNames = TextEditor::BaseFileFind::replaceAll(text, items, preserveCase);
if (!fileNames.isEmpty()) { if (!fileNames.isEmpty()) {
m_modelManager->updateSourceFiles(fileNames.toSet()); m_modelManager->updateSourceFiles(Utils::toSet(fileNames));
SearchResultWindow::instance()->hide(); SearchResultWindow::instance()->hide();
} }

View File

@@ -479,7 +479,7 @@ void CppModelManager::initCppTools()
this, &CppModelManager::updateModifiedSourceFiles); this, &CppModelManager::updateModifiedSourceFiles);
connect(Core::DocumentManager::instance(), &Core::DocumentManager::filesChangedInternally, connect(Core::DocumentManager::instance(), &Core::DocumentManager::filesChangedInternally,
[this](const QStringList &files) { [this](const QStringList &files) {
updateSourceFiles(files.toSet()); updateSourceFiles(Utils::toSet(files));
}); });
connect(this, &CppModelManager::documentUpdated, connect(this, &CppModelManager::documentUpdated,
@@ -925,7 +925,7 @@ public:
{ {
QSet<QString> removed = projectPartIds(m_old.projectParts()); QSet<QString> removed = projectPartIds(m_old.projectParts());
removed.subtract(projectPartIds(m_new.projectParts())); removed.subtract(projectPartIds(m_new.projectParts()));
return removed.toList(); return Utils::toList(removed);
} }
/// Returns a list of common files that have a changed timestamp. /// Returns a list of common files that have a changed timestamp.
@@ -1020,7 +1020,7 @@ void CppModelManager::updateCppEditorDocuments(bool projectsUpdated) const
// Mark invisible documents dirty // Mark invisible documents dirty
QSet<Core::IDocument *> invisibleCppEditorDocuments QSet<Core::IDocument *> invisibleCppEditorDocuments
= Core::DocumentModel::openedDocuments().toSet(); = Utils::toSet(Core::DocumentModel::openedDocuments());
invisibleCppEditorDocuments.subtract(visibleCppEditorDocuments); invisibleCppEditorDocuments.subtract(visibleCppEditorDocuments);
foreach (Core::IDocument *document, invisibleCppEditorDocuments) { foreach (Core::IDocument *document, invisibleCppEditorDocuments) {
const QString filePath = document->filePath().toString(); const QString filePath = document->filePath().toString();
@@ -1085,7 +1085,7 @@ QFuture<void> CppModelManager::updateProjectInfo(QFutureInterface<void> &futureI
const QSet<QString> removedFiles = comparer.removedFiles(); const QSet<QString> removedFiles = comparer.removedFiles();
if (!removedFiles.isEmpty()) { if (!removedFiles.isEmpty()) {
filesRemoved = true; filesRemoved = true;
emit aboutToRemoveFiles(removedFiles.toList()); emit aboutToRemoveFiles(Utils::toList(removedFiles));
removeFilesFromSnapshot(removedFiles); removeFilesFromSnapshot(removedFiles);
} }
} }
@@ -1150,9 +1150,8 @@ QList<ProjectPart::Ptr> CppModelManager::projectPartFromDependencies(
const Utils::FilePathList deps = snapshot().filesDependingOn(fileName); const Utils::FilePathList deps = snapshot().filesDependingOn(fileName);
QMutexLocker locker(&d->m_projectMutex); QMutexLocker locker(&d->m_projectMutex);
foreach (const Utils::FilePath &dep, deps) { for (const Utils::FilePath &dep : deps)
parts.unite(QSet<ProjectPart::Ptr>::fromList(d->m_fileToProjectParts.value(dep))); parts.unite(Utils::toSet(d->m_fileToProjectParts.value(dep)));
}
return parts.values(); return parts.values();
} }
@@ -1218,10 +1217,10 @@ void CppModelManager::delayedGC()
static QStringList removedProjectParts(const QStringList &before, const QStringList &after) static QStringList removedProjectParts(const QStringList &before, const QStringList &after)
{ {
QSet<QString> b = before.toSet(); QSet<QString> b = Utils::toSet(before);
b.subtract(after.toSet()); b.subtract(Utils::toSet(after));
return b.toList(); return Utils::toList(b);
} }
void CppModelManager::onAboutToRemoveProject(ProjectExplorer::Project *project) void CppModelManager::onAboutToRemoveProject(ProjectExplorer::Project *project)

View File

@@ -568,7 +568,7 @@ void CppToolsPlugin::test_modelmanager_snapshot_after_two_projects()
{"foo.h", "foo.cpp", "main.cpp"}); {"foo.h", "foo.cpp", "main.cpp"});
refreshedFiles = helper.updateProjectInfo(project1.projectInfo); refreshedFiles = helper.updateProjectInfo(project1.projectInfo);
QCOMPARE(refreshedFiles, project1.projectFiles.toSet()); QCOMPARE(refreshedFiles, Utils::toSet(project1.projectFiles));
const int snapshotSizeAfterProject1 = mm->snapshot().size(); const int snapshotSizeAfterProject1 = mm->snapshot().size();
foreach (const QString &file, project1.projectFiles) foreach (const QString &file, project1.projectFiles)
@@ -580,7 +580,7 @@ void CppToolsPlugin::test_modelmanager_snapshot_after_two_projects()
{"bar.h", "bar.cpp", "main.cpp"}); {"bar.h", "bar.cpp", "main.cpp"});
refreshedFiles = helper.updateProjectInfo(project2.projectInfo); refreshedFiles = helper.updateProjectInfo(project2.projectInfo);
QCOMPARE(refreshedFiles, project2.projectFiles.toSet()); QCOMPARE(refreshedFiles, Utils::toSet(project2.projectFiles));
const int snapshotSizeAfterProject2 = mm->snapshot().size(); const int snapshotSizeAfterProject2 = mm->snapshot().size();
QVERIFY(snapshotSizeAfterProject2 > snapshotSizeAfterProject1); QVERIFY(snapshotSizeAfterProject2 > snapshotSizeAfterProject1);

View File

@@ -129,7 +129,7 @@ void SymbolsFindFilter::startSearch(SearchResult *search)
QSet<QString> projectFileNames; QSet<QString> projectFileNames;
if (parameters.scope == SymbolSearcher::SearchProjectsOnly) { if (parameters.scope == SymbolSearcher::SearchProjectsOnly) {
for (ProjectExplorer::Project *project : ProjectExplorer::SessionManager::projects()) for (ProjectExplorer::Project *project : ProjectExplorer::SessionManager::projects())
projectFileNames += Utils::transform(project->files(ProjectExplorer::Project::AllFiles), &Utils::FilePath::toString).toSet(); projectFileNames += Utils::transform<QSet>(project->files(ProjectExplorer::Project::AllFiles), &Utils::FilePath::toString);
} }
auto watcher = new QFutureWatcher<SearchResultItem>; auto watcher = new QFutureWatcher<SearchResultItem>;

View File

@@ -2439,7 +2439,7 @@ GlobalBreakpoints BreakpointManager::findBreakpointsByIndex(const QList<QModelIn
if (GlobalBreakpoint gbp = findBreakpointByIndex(index)) if (GlobalBreakpoint gbp = findBreakpointByIndex(index))
items.insert(gbp); items.insert(gbp);
} }
return items.toList(); return Utils::toList(items);
} }
GlobalBreakpoint BreakpointManager::createBreakpoint(const BreakpointParameters &params) GlobalBreakpoint BreakpointManager::createBreakpoint(const BreakpointParameters &params)

View File

@@ -506,7 +506,7 @@ void DebuggerMainWindow::savePersistentSettings()
QSettings *settings = ICore::settings(); QSettings *settings = ICore::settings();
settings->beginGroup(MAINWINDOW_KEY); settings->beginGroup(MAINWINDOW_KEY);
settings->setValue(CHANGED_DOCK_KEY, QStringList(changedDocks.toList())); settings->setValue(CHANGED_DOCK_KEY, QStringList(Utils::toList(changedDocks)));
settings->setValue(STATE_KEY, states); settings->setValue(STATE_KEY, states);
settings->setValue(AUTOHIDE_TITLEBARS_KEY, theMainWindow->autoHideTitleBars()); settings->setValue(AUTOHIDE_TITLEBARS_KEY, theMainWindow->autoHideTitleBars());
settings->setValue(SHOW_CENTRALWIDGET_KEY, theMainWindow->isCentralWidgetShown()); settings->setValue(SHOW_CENTRALWIDGET_KEY, theMainWindow->isCentralWidgetShown());

View File

@@ -2805,9 +2805,9 @@ GitClient::RevertResult GitClient::revertI(QStringList files,
QStringList stagedFiles = allStagedFiles; QStringList stagedFiles = allStagedFiles;
QStringList unstagedFiles = allUnstagedFiles; QStringList unstagedFiles = allUnstagedFiles;
if (!isDirectory) { if (!isDirectory) {
const QSet<QString> filesSet = files.toSet(); const QSet<QString> filesSet = Utils::toSet(files);
stagedFiles = allStagedFiles.toSet().intersect(filesSet).toList(); stagedFiles = Utils::toList(Utils::toSet(allStagedFiles).intersect(filesSet));
unstagedFiles = allUnstagedFiles.toSet().intersect(filesSet).toList(); unstagedFiles = Utils::toList(Utils::toSet(allUnstagedFiles).intersect(filesSet));
} }
if ((!revertStaging || stagedFiles.empty()) && unstagedFiles.empty()) if ((!revertStaging || stagedFiles.empty()) && unstagedFiles.empty())
return RevertUnchanged; return RevertUnchanged;

View File

@@ -210,7 +210,7 @@ void DocSettingsPage::addDocumentation()
// file with the same namespace but a different path, we need to unregister the namespace before // file with the same namespace but a different path, we need to unregister the namespace before
// we can register the new one. Help engine allows just one registered namespace. // we can register the new one. Help engine allows just one registered namespace.
if (m_filesToUnregister.contains(nameSpace)) { if (m_filesToUnregister.contains(nameSpace)) {
QSet<QString> values = m_filesToUnregister.values(nameSpace).toSet(); QSet<QString> values = Utils::toSet(m_filesToUnregister.values(nameSpace));
values.remove(filePath); values.remove(filePath);
m_filesToUnregister.remove(nameSpace); m_filesToUnregister.remove(nameSpace);
foreach (const QString &value, values) foreach (const QString &value, values)

View File

@@ -32,6 +32,8 @@
#include <coreplugin/helpmanager.h> #include <coreplugin/helpmanager.h>
#include <utils/algorithm.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
@@ -99,7 +101,7 @@ void FilterSettingsPage::updateFilterPage()
QSet<QString> attributes; QSet<QString> attributes;
filters = HelpManager::filters(); filters = HelpManager::filters();
for (it = filters.constBegin(); it != filters.constEnd(); ++it) for (it = filters.constBegin(); it != filters.constEnd(); ++it)
attributes += it.value().toSet(); attributes += Utils::toSet(it.value());
foreach (const QString &attribute, attributes) foreach (const QString &attribute, attributes)
new QTreeWidgetItem(m_ui.attributeWidget, QStringList(attribute)); new QTreeWidgetItem(m_ui.attributeWidget, QStringList(attribute));

View File

@@ -372,12 +372,12 @@ void HelpManager::setupHelpManager()
d->cleanUpDocumentation(); d->cleanUpDocumentation();
if (!d->m_nameSpacesToUnregister.isEmpty()) { if (!d->m_nameSpacesToUnregister.isEmpty()) {
m_instance->unregisterDocumentation(d->m_nameSpacesToUnregister.toList()); m_instance->unregisterDocumentation(Utils::toList(d->m_nameSpacesToUnregister));
d->m_nameSpacesToUnregister.clear(); d->m_nameSpacesToUnregister.clear();
} }
if (!d->m_filesToRegister.isEmpty()) { if (!d->m_filesToRegister.isEmpty()) {
m_instance->registerDocumentation(d->m_filesToRegister.toList()); m_instance->registerDocumentation(Utils::toList(d->m_filesToRegister));
d->m_filesToRegister.clear(); d->m_filesToRegister.clear();
} }
@@ -432,13 +432,13 @@ const QStringList HelpManagerPrivate::documentationFromInstaller()
void HelpManagerPrivate::readSettings() void HelpManagerPrivate::readSettings()
{ {
m_userRegisteredFiles = ICore::settings()->value(QLatin1String(kUserDocumentationKey)) m_userRegisteredFiles = Utils::toSet(ICore::settings()->value(QLatin1String(kUserDocumentationKey))
.toStringList().toSet(); .toStringList());
} }
void HelpManagerPrivate::writeSettings() void HelpManagerPrivate::writeSettings()
{ {
const QStringList list = m_userRegisteredFiles.toList(); const QStringList list = Utils::toList(m_userRegisteredFiles);
ICore::settings()->setValue(QLatin1String(kUserDocumentationKey), list); ICore::settings()->setValue(QLatin1String(kUserDocumentationKey), list);
} }

View File

@@ -25,6 +25,7 @@
#include "iosprobe.h" #include "iosprobe.h"
#include <utils/algorithm.h>
#include <utils/synchronousprocess.h> #include <utils/synchronousprocess.h>
#include <QDir> #include <QDir>
@@ -118,7 +119,7 @@ void XcodeProbe::setupDefaultToolchains(const QString &devPath)
const QFileInfo sdkPathInfo(sdk.path.toString()); const QFileInfo sdkPathInfo(sdk.path.toString());
if (sdkPathInfo.exists() && sdkPathInfo.isDir()) { if (sdkPathInfo.exists() && sdkPathInfo.isDir()) {
clangProfile.sdks.push_back(sdk); clangProfile.sdks.push_back(sdk);
allArchitectures += sdk.architectures.toSet(); allArchitectures += Utils::toSet(sdk.architectures);
} }
} }

View File

@@ -42,6 +42,8 @@
#include "qmt/tasks/diagramscenecontroller.h" #include "qmt/tasks/diagramscenecontroller.h"
#include <projectexplorer/projectnodes.h> #include <projectexplorer/projectnodes.h>
#include <utils/algorithm.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QAction> #include <QAction>
@@ -154,7 +156,7 @@ void PxNodeController::addFileSystemEntry(const QString &filePath, int line, int
auto menu = new QMenu; auto menu = new QMenu;
menu->addAction(new MenuAction(tr("Add Component %1").arg(elementName), elementName, menu->addAction(new MenuAction(tr("Add Component %1").arg(elementName), elementName,
MenuAction::TYPE_ADD_COMPONENT, menu)); MenuAction::TYPE_ADD_COMPONENT, menu));
QStringList classNames = d->classViewController->findClassDeclarations(filePath, line, column).toList(); QStringList classNames = Utils::toList(d->classViewController->findClassDeclarations(filePath, line, column));
if (!classNames.empty()) { if (!classNames.empty()) {
menu->addSeparator(); menu->addSeparator();
int index = 0; int index = 0;

View File

@@ -64,7 +64,7 @@ DeployableFile DeploymentData::deployableForLocalFile(const QString &localFilePa
bool DeploymentData::operator==(const DeploymentData &other) const bool DeploymentData::operator==(const DeploymentData &other) const
{ {
return m_files.toSet() == other.m_files.toSet() return Utils::toSet(m_files) == Utils::toSet(other.m_files)
&& m_localInstallRoot == other.m_localInstallRoot; && m_localInstallRoot == other.m_localInstallRoot;
} }

View File

@@ -215,7 +215,7 @@ JsonWizardGenerator::OverwriteResult JsonWizardGenerator::promptForOverwrite(Jso
if (overwriteDialog.exec() != QDialog::Accepted) if (overwriteDialog.exec() != QDialog::Accepted)
return OverwriteCanceled; return OverwriteCanceled;
const QSet<QString> existingFilesToKeep = QSet<QString>::fromList(overwriteDialog.uncheckedFiles()); const QSet<QString> existingFilesToKeep = Utils::toSet(overwriteDialog.uncheckedFiles());
if (existingFilesToKeep.size() == files->size()) // All exist & all unchecked->Cancel. if (existingFilesToKeep.size() == files->size()) // All exist & all unchecked->Cancel.
return OverwriteCanceled; return OverwriteCanceled;

View File

@@ -226,14 +226,14 @@ public:
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
layout->setColumnStretch(1, 2); layout->setColumnStretch(1, 2);
QList<Core::Id> languageList = ToolChainManager::allLanguages().toList(); QList<Core::Id> languageList = Utils::toList(ToolChainManager::allLanguages());
Utils::sort(languageList, [](Core::Id l1, Core::Id l2) { Utils::sort(languageList, [](Core::Id l1, Core::Id l2) {
return ToolChainManager::displayNameOfLanguageId(l1) return ToolChainManager::displayNameOfLanguageId(l1)
< ToolChainManager::displayNameOfLanguageId(l2); < ToolChainManager::displayNameOfLanguageId(l2);
}); });
QTC_ASSERT(!languageList.isEmpty(), return); QTC_ASSERT(!languageList.isEmpty(), return);
int row = 0; int row = 0;
foreach (Core::Id l, languageList) { for (Core::Id l : qAsConst(languageList)) {
layout->addWidget(new QLabel(ToolChainManager::displayNameOfLanguageId(l) + ':'), row, 0); layout->addWidget(new QLabel(ToolChainManager::displayNameOfLanguageId(l) + ':'), row, 0);
auto cb = new QComboBox; auto cb = new QComboBox;
cb->setSizePolicy(QSizePolicy::Ignored, cb->sizePolicy().verticalPolicy()); cb->setSizePolicy(QSizePolicy::Ignored, cb->sizePolicy().verticalPolicy());
@@ -385,7 +385,7 @@ Tasks ToolChainKitAspect::validate(const Kit *k) const
} }
if (targetAbis.count() != 1) { if (targetAbis.count() != 1) {
result << Task(Task::Error, tr("Compilers produce code for different ABIs: %1") result << Task(Task::Error, tr("Compilers produce code for different ABIs: %1")
.arg(Utils::transform(targetAbis, &Abi::toString).toList().join(", ")), .arg(Utils::transform<QList>(targetAbis, &Abi::toString).join(", ")),
Utils::FilePath(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)); Utils::FilePath(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
} }
} }
@@ -606,7 +606,7 @@ QList<ToolChain *> ToolChainKitAspect::toolChains(const Kit *k)
const QVariantMap value = k->value(ToolChainKitAspect::id()).toMap(); const QVariantMap value = k->value(ToolChainKitAspect::id()).toMap();
const QList<ToolChain *> tcList const QList<ToolChain *> tcList
= Utils::transform(ToolChainManager::allLanguages().toList(), = Utils::transform<QList>(ToolChainManager::allLanguages(),
[&value](Core::Id l) -> ToolChain * { [&value](Core::Id l) -> ToolChain * {
return ToolChainManager::findToolChain(value.value(l.toString()).toByteArray()); return ToolChainManager::findToolChain(value.value(l.toString()).toByteArray());
}); });

View File

@@ -55,7 +55,7 @@ SelectableFilesModel::SelectableFilesModel(QObject *parent) : QAbstractItemModel
void SelectableFilesModel::setInitialMarkedFiles(const Utils::FilePathList &files) void SelectableFilesModel::setInitialMarkedFiles(const Utils::FilePathList &files)
{ {
m_files = files.toSet(); m_files = Utils::toSet(files);
m_allFiles = files.isEmpty(); m_allFiles = files.isEmpty();
} }
@@ -320,14 +320,14 @@ void SelectableFilesModel::collectPaths(Tree *root, Utils::FilePathList *result)
Utils::FilePathList SelectableFilesModel::selectedFiles() const Utils::FilePathList SelectableFilesModel::selectedFiles() const
{ {
Utils::FilePathList result = m_outOfBaseDirFiles.toList(); Utils::FilePathList result = Utils::toList(m_outOfBaseDirFiles);
collectFiles(m_root, &result); collectFiles(m_root, &result);
return result; return result;
} }
Utils::FilePathList SelectableFilesModel::preservedFiles() const Utils::FilePathList SelectableFilesModel::preservedFiles() const
{ {
return m_outOfBaseDirFiles.toList(); return Utils::toList(m_outOfBaseDirFiles);
} }
bool SelectableFilesModel::hasCheckedFiles() const bool SelectableFilesModel::hasCheckedFiles() const

View File

@@ -347,7 +347,7 @@ DeploymentData Target::deploymentData() const
void Target::setApplicationTargets(const QList<BuildTargetInfo> &appTargets) void Target::setApplicationTargets(const QList<BuildTargetInfo> &appTargets)
{ {
if (appTargets.toSet() != d->m_appTargets.toSet()) { if (Utils::toSet(appTargets) != Utils::toSet(d->m_appTargets)) {
d->m_appTargets = appTargets; d->m_appTargets = appTargets;
emit applicationTargetsChanged(); emit applicationTargetsChanged();
} }

View File

@@ -190,7 +190,7 @@ public:
m_addButton = new QPushButton(ToolChainOptionsPage::tr("Add"), this); m_addButton = new QPushButton(ToolChainOptionsPage::tr("Add"), this);
auto addMenu = new QMenu; auto addMenu = new QMenu;
foreach (ToolChainFactory *factory, m_factories) { foreach (ToolChainFactory *factory, m_factories) {
QList<Core::Id> languages = factory->supportedLanguages().toList(); QList<Core::Id> languages = Utils::toList(factory->supportedLanguages());
if (languages.isEmpty()) if (languages.isEmpty())
continue; continue;

View File

@@ -89,7 +89,7 @@ static QList<ToolChain *> makeUniqueByEqual(const QList<ToolChain *> &a)
static QList<ToolChain *> makeUniqueByPointerEqual(const QList<ToolChain *> &a) static QList<ToolChain *> makeUniqueByPointerEqual(const QList<ToolChain *> &a)
{ {
return QSet<ToolChain *>::fromList(a).toList(); return Utils::toList(Utils::toSet(a));
} }
static QList<ToolChain *> subtractById(const QList<ToolChain *> &a, const QList<ToolChain *> &b) static QList<ToolChain *> subtractById(const QList<ToolChain *> &a, const QList<ToolChain *> &b)
@@ -480,12 +480,12 @@ void ProjectExplorerPlugin::testToolChainMerging()
Internal::ToolChainOperations ops = Internal::mergeToolChainLists(system, user, autodetect); Internal::ToolChainOperations ops = Internal::mergeToolChainLists(system, user, autodetect);
QSet<ToolChain *> expToRegister = QSet<ToolChain *>::fromList(toRegister); QSet<ToolChain *> expToRegister = Utils::toSet(toRegister);
QSet<ToolChain *> expToDemote = QSet<ToolChain *>::fromList(toDemote); QSet<ToolChain *> expToDemote = Utils::toSet(toDemote);
QSet<ToolChain *> actToRegister = QSet<ToolChain *>::fromList(ops.toRegister); QSet<ToolChain *> actToRegister = Utils::toSet(ops.toRegister);
QSet<ToolChain *> actToDemote = QSet<ToolChain *>::fromList(ops.toDemote); QSet<ToolChain *> actToDemote = Utils::toSet(ops.toDemote);
QSet<ToolChain *> actToDelete = QSet<ToolChain *>::fromList(ops.toDelete); QSet<ToolChain *> actToDelete = Utils::toSet(ops.toDelete);
QCOMPARE(actToRegister.count(), ops.toRegister.count()); // no dups! QCOMPARE(actToRegister.count(), ops.toRegister.count()); // no dups!
QCOMPARE(actToDemote.count(), ops.toDemote.count()); // no dups! QCOMPARE(actToDemote.count(), ops.toDemote.count()); // no dups!
@@ -501,12 +501,12 @@ void ProjectExplorerPlugin::testToolChainMerging()
tmp = actToRegister; tmp = actToRegister;
tmp.unite(actToDelete); tmp.unite(actToDelete);
QCOMPARE(tmp, QSet<ToolChain *>::fromList(system + user + autodetect)); // All input is accounted for QCOMPARE(tmp, Utils::toSet(system + user + autodetect)); // All input is accounted for
QCOMPARE(expToRegister, actToRegister); QCOMPARE(expToRegister, actToRegister);
QCOMPARE(expToDemote, actToDemote); QCOMPARE(expToDemote, actToDemote);
QCOMPARE(QSet<ToolChain *>::fromList(system + user + autodetect), QCOMPARE(Utils::toSet(system + user + autodetect),
QSet<ToolChain *>::fromList(ops.toRegister + ops.toDemote + ops.toDelete)); Utils::toSet(ops.toRegister + ops.toDemote + ops.toDelete));
} }
} // namespace ProjectExplorer } // namespace ProjectExplorer

View File

@@ -392,7 +392,7 @@ static QStringList readLinesJson(const Utils::FilePath &projectFile,
for (const auto &file : files_array) for (const auto &file : files_array)
visited.insert(file.toString()); visited.insert(file.toString());
lines.append(visited.toList()); lines.append(Utils::toList(visited));
} }
return lines; return lines;

View File

@@ -925,7 +925,7 @@ void CentralizedFolderWatcher::delayedFolderChanged(const QString &folder)
QSet<QString> alreadyAdded = m_watcher.directories().toSet(); QSet<QString> alreadyAdded = m_watcher.directories().toSet();
tmp.subtract(alreadyAdded); tmp.subtract(alreadyAdded);
if (!tmp.isEmpty()) if (!tmp.isEmpty())
m_watcher.addPaths(tmp.toList()); m_watcher.addPaths(Utils::toList(tmp));
m_recursiveWatchedFolders += tmp; m_recursiveWatchedFolders += tmp;
} }

View File

@@ -25,6 +25,7 @@
#include "filefilteritems.h" #include "filefilteritems.h"
#include <utils/algorithm.h>
#include <utils/filesystemwatcher.h> #include <utils/filesystemwatcher.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -160,7 +161,7 @@ void FileFilterBaseItem::setPathsProperty(const QStringList &path)
QStringList FileFilterBaseItem::files() const QStringList FileFilterBaseItem::files() const
{ {
return m_files.toList(); return Utils::toList(m_files);
} }
/** /**
@@ -243,16 +244,16 @@ void FileFilterBaseItem::updateFileListNow()
} }
// update watched directories // update watched directories
const QSet<QString> oldDirs = watchedDirectories().toSet(); const QSet<QString> oldDirs = Utils::toSet(watchedDirectories());
const QSet<QString> unwatchDirs = oldDirs - dirsToBeWatched; const QSet<QString> unwatchDirs = oldDirs - dirsToBeWatched;
const QSet<QString> watchDirs = dirsToBeWatched - oldDirs; const QSet<QString> watchDirs = dirsToBeWatched - oldDirs;
if (!unwatchDirs.isEmpty()) { if (!unwatchDirs.isEmpty()) {
QTC_ASSERT(m_dirWatcher, return); QTC_ASSERT(m_dirWatcher, return);
m_dirWatcher->removeDirectories(unwatchDirs.toList()); m_dirWatcher->removeDirectories(Utils::toList(unwatchDirs));
} }
if (!watchDirs.isEmpty()) if (!watchDirs.isEmpty())
dirWatcher()->addDirectories(watchDirs.toList(), Utils::FileSystemWatcher::WatchAllChanges); dirWatcher()->addDirectories(Utils::toList(watchDirs), Utils::FileSystemWatcher::WatchAllChanges);
} }
bool FileFilterBaseItem::fileMatches(const QString &fileName) const bool FileFilterBaseItem::fileMatches(const QString &fileName) const

View File

@@ -275,7 +275,7 @@ void QmlProject::refreshFiles(const QSet<QString> &/*added*/, const QSet<QString
refresh(Files); refresh(Files);
if (!removed.isEmpty()) { if (!removed.isEmpty()) {
if (auto modelManager = QmlJS::ModelManagerInterface::instance()) if (auto modelManager = QmlJS::ModelManagerInterface::instance())
modelManager->removeFiles(removed.toList()); modelManager->removeFiles(Utils::toList(removed));
} }
refreshTargetDirectory(); refreshTargetDirectory();
} }

View File

@@ -422,7 +422,7 @@ static FilePathList gatherQmakePathsFromQtChooser()
if (!possibleQMake.isEmpty()) if (!possibleQMake.isEmpty())
foundQMakes << possibleQMake; foundQMakes << possibleQMake;
} }
return foundQMakes.toList(); return Utils::toList(foundQMakes);
} }
static void findSystemQt() static void findSystemQt()

View File

@@ -123,7 +123,7 @@ void TodoItemsProvider::createScanners()
void TodoItemsProvider::setItemsListWithinStartupProject() void TodoItemsProvider::setItemsListWithinStartupProject()
{ {
QHashIterator<FilePath, QList<TodoItem> > it(m_itemsHash); QHashIterator<FilePath, QList<TodoItem> > it(m_itemsHash);
const auto filePaths = QSet<FilePath>::fromList(m_startupProject->files(Project::SourceFiles)); const auto filePaths = Utils::toSet(m_startupProject->files(Project::SourceFiles));
QVariantMap settings = m_startupProject->namedSettings(Constants::SETTINGS_NAME_KEY).toMap(); QVariantMap settings = m_startupProject->namedSettings(Constants::SETTINGS_NAME_KEY).toMap();
@@ -159,8 +159,7 @@ void TodoItemsProvider::setItemsListWithinSubproject()
}); });
// files must be both in the current subproject and the startup-project. // files must be both in the current subproject and the startup-project.
const auto fileNames const auto fileNames = Utils::toSet(m_startupProject->files(Project::SourceFiles));
= QSet<FilePath>::fromList(m_startupProject->files(Project::SourceFiles));
QHashIterator<FilePath, QList<TodoItem> > it(m_itemsHash); QHashIterator<FilePath, QList<TodoItem> > it(m_itemsHash);
while (it.hasNext()) { while (it.hasNext()) {
it.next(); it.next();

View File

@@ -24,9 +24,12 @@
****************************************************************************/ ****************************************************************************/
#include "baseannotationhighlighter.h" #include "baseannotationhighlighter.h"
#include <texteditor/fontsettings.h> #include <texteditor/fontsettings.h>
#include <texteditor/texteditorsettings.h> #include <texteditor/texteditorsettings.h>
#include <utils/algorithm.h>
#include <QDebug> #include <QDebug>
#include <QColor> #include <QColor>
#include <QTextDocument> #include <QTextDocument>
@@ -68,7 +71,7 @@ void BaseAnnotationHighlighterPrivate::updateOtherFormats()
.toTextCharFormat(TextEditor::C_TEXT) .toTextCharFormat(TextEditor::C_TEXT)
.brushProperty(QTextFormat::BackgroundBrush) .brushProperty(QTextFormat::BackgroundBrush)
.color(); .color();
q->setChangeNumbers(m_changeNumberMap.keys().toSet()); q->setChangeNumbers(Utils::toSet(m_changeNumberMap.keys()));
} }
BaseAnnotationHighlighter::BaseAnnotationHighlighter(const ChangeNumbers &changeNumbers, BaseAnnotationHighlighter::BaseAnnotationHighlighter(const ChangeNumbers &changeNumbers,

View File

@@ -37,17 +37,21 @@
#include <aggregation/aggregate.h> #include <aggregation/aggregate.h>
#include <cpptools/cppmodelmanager.h> #include <cpptools/cppmodelmanager.h>
#include <coreplugin/find/basetextfind.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <utils/algorithm.h>
#include <utils/checkablemessagebox.h> #include <utils/checkablemessagebox.h>
#include <utils/completingtextedit.h> #include <utils/completingtextedit.h>
#include <utils/synchronousprocess.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/icon.h> #include <utils/icon.h>
#include <utils/theme/theme.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/synchronousprocess.h>
#include <utils/temporarydirectory.h> #include <utils/temporarydirectory.h>
#include <coreplugin/find/basetextfind.h> #include <utils/theme/theme.h>
#include <texteditor/fontsettings.h> #include <texteditor/fontsettings.h>
#include <texteditor/texteditorsettings.h> #include <texteditor/texteditorsettings.h>
@@ -459,7 +463,7 @@ void VcsBaseSubmitEditor::setFileModel(SubmitFileModel *model)
// Populate completer with symbols // Populate completer with symbols
if (!uniqueSymbols.isEmpty()) { if (!uniqueSymbols.isEmpty()) {
QCompleter *completer = d->m_widget->descriptionEdit()->completer(); QCompleter *completer = d->m_widget->descriptionEdit()->completer();
QStringList symbolsList = uniqueSymbols.toList(); QStringList symbolsList = Utils::toList(uniqueSymbols);
symbolsList.sort(); symbolsList.sort();
completer->setModel(new QStringListModel(symbolsList, completer)); completer->setModel(new QStringListModel(symbolsList, completer));
} }