forked from qt-creator/qt-creator
use initializer lists
Change-Id: I82b04601f1db52197b3dc625b6b7e0f143c1c8b6 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -180,7 +180,7 @@ public:
|
||||
bool setData(int column, const QVariant &data, int role) override
|
||||
{
|
||||
if (column == LoadedColumn && role == Qt::CheckStateRole)
|
||||
return m_view->setPluginsEnabled(QSet<PluginSpec *>() << m_spec, data.toBool());
|
||||
return m_view->setPluginsEnabled({m_spec}, data.toBool());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -1202,7 +1202,7 @@ void PropertiesView::MView::onClassMembersChanged(QList<MClassMember> &classMemb
|
||||
&MClass::members, &MClass::setMembers);
|
||||
foreach (DElement *element, m_diagramElements) {
|
||||
if (showMembers.contains(element->modelUid())) {
|
||||
assignModelElement<DClass, bool>(QList<DElement *>() << element, SelectionSingle, true,
|
||||
assignModelElement<DClass, bool>(QList<DElement *>({element}), SelectionSingle, true,
|
||||
&DClass::showAllMembers, &DClass::setShowAllMembers);
|
||||
}
|
||||
}
|
||||
|
@@ -510,9 +510,9 @@ void Wizard::_q_pageAdded(int pageId)
|
||||
nextItem = d->m_wizardProgress->item(nextId);
|
||||
|
||||
if (prevItem)
|
||||
prevItem->setNextItems(QList<WizardProgressItem *>() << item);
|
||||
prevItem->setNextItems({item});
|
||||
if (nextItem)
|
||||
item->setNextItems(QList<WizardProgressItem *>() << nextItem);
|
||||
item->setNextItems({nextItem});
|
||||
}
|
||||
|
||||
void Wizard::_q_pageRemoved(int pageId)
|
||||
@@ -626,7 +626,7 @@ QList<WizardProgressItem *> WizardProgressPrivate::singlePathBetween(WizardProgr
|
||||
// When we had X->A in addition and "from" was X and "to" was C, this would not work
|
||||
// (it should return the shortest path which would be X->A->C).
|
||||
if (item->nextItems().contains(toItem))
|
||||
return QList<WizardProgressItem *>() << toItem;
|
||||
return {toItem};
|
||||
|
||||
QHash<WizardProgressItem *, QHash<WizardProgressItem *, bool> > visitedItemsToParents;
|
||||
QList<QPair<WizardProgressItem *, WizardProgressItem *> > workingItems; // next to prev item
|
||||
@@ -662,7 +662,7 @@ QList<WizardProgressItem *> WizardProgressPrivate::singlePathBetween(WizardProgr
|
||||
return path;
|
||||
itItem = visitedItemsToParents.constFind(it);
|
||||
}
|
||||
return QList<WizardProgressItem *>();
|
||||
return {};
|
||||
}
|
||||
|
||||
void WizardProgressPrivate::updateReachableItems()
|
||||
|
@@ -218,7 +218,7 @@ ClangTidyClazyTool::ClangTidyClazyTool()
|
||||
m_diagnosticView->setWindowTitle(tr("Clang-Tidy and Clazy Issues"));
|
||||
|
||||
foreach (auto * const model,
|
||||
QList<QAbstractItemModel *>() << m_diagnosticModel << m_diagnosticFilterModel) {
|
||||
QList<QAbstractItemModel *>({m_diagnosticModel, m_diagnosticFilterModel})) {
|
||||
connect(model, &QAbstractItemModel::rowsInserted,
|
||||
this, &ClangTidyClazyTool::handleStateUpdate);
|
||||
connect(model, &QAbstractItemModel::rowsRemoved,
|
||||
|
@@ -132,7 +132,7 @@ void DiagnosticView::suppressCurrentDiagnostic()
|
||||
|
||||
QList<QAction *> DiagnosticView::customActions() const
|
||||
{
|
||||
return QList<QAction *>() << m_suppressAction;
|
||||
return {m_suppressAction};
|
||||
}
|
||||
|
||||
bool DiagnosticView::eventFilter(QObject *watched, QEvent *event)
|
||||
|
@@ -895,7 +895,7 @@ bool DocumentManager::saveModifiedDocumentsSilently(const QList<IDocument *> &do
|
||||
bool DocumentManager::saveModifiedDocumentSilently(IDocument *document, bool *canceled,
|
||||
QList<IDocument *> *failedToClose)
|
||||
{
|
||||
return saveModifiedDocumentsSilently(QList<IDocument *>() << document, canceled, failedToClose);
|
||||
return saveModifiedDocumentsSilently({document}, canceled, failedToClose);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -957,7 +957,7 @@ bool DocumentManager::saveModifiedDocument(IDocument *document, const QString &m
|
||||
const QString &alwaysSaveMessage, bool *alwaysSave,
|
||||
QList<IDocument *> *failedToClose)
|
||||
{
|
||||
return saveModifiedDocuments(QList<IDocument *>() << document, message, canceled,
|
||||
return saveModifiedDocuments({document}, message, canceled,
|
||||
alwaysSaveMessage, alwaysSave, failedToClose);
|
||||
}
|
||||
|
||||
|
@@ -2189,7 +2189,7 @@ bool EditorManagerPrivate::saveDocumentAs(IDocument *document)
|
||||
// close existing editors for the new file name
|
||||
IDocument *otherDocument = DocumentModel::documentForFilePath(absoluteFilePath);
|
||||
if (otherDocument)
|
||||
EditorManager::closeDocuments(QList<IDocument *>() << otherDocument, false);
|
||||
EditorManager::closeDocuments({otherDocument}, false);
|
||||
}
|
||||
|
||||
emit m_instance->aboutToSave(document);
|
||||
@@ -2569,9 +2569,8 @@ void EditorManager::revertToSaved()
|
||||
|
||||
void EditorManager::closeEditor(IEditor *editor, bool askAboutModifiedEditors)
|
||||
{
|
||||
if (!editor)
|
||||
return;
|
||||
closeEditors(QList<IEditor *>() << editor, askAboutModifiedEditors);
|
||||
if (editor)
|
||||
closeEditors({editor}, askAboutModifiedEditors);
|
||||
}
|
||||
|
||||
void EditorManager::closeDocument(DocumentModel::Entry *entry)
|
||||
@@ -2581,7 +2580,7 @@ void EditorManager::closeDocument(DocumentModel::Entry *entry)
|
||||
if (entry->isSuspended)
|
||||
DocumentModelPrivate::removeEntry(entry);
|
||||
else
|
||||
closeDocuments(QList<IDocument *>() << entry->document);
|
||||
closeDocuments({entry->document});
|
||||
}
|
||||
|
||||
bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool askAboutModifiedEditors)
|
||||
@@ -2856,7 +2855,7 @@ QList<IEditor*> EditorManager::visibleEditors()
|
||||
|
||||
bool EditorManager::closeDocument(IDocument *document, bool askAboutModifiedEditors)
|
||||
{
|
||||
return closeDocuments(QList<IDocument *>() << document, askAboutModifiedEditors);
|
||||
return closeDocuments({document}, askAboutModifiedEditors);
|
||||
}
|
||||
|
||||
bool EditorManager::closeDocuments(const QList<IDocument *> &documents, bool askAboutModifiedEditors)
|
||||
|
@@ -46,10 +46,9 @@ BasicLocatorFilterTest::~BasicLocatorFilterTest() = default;
|
||||
QList<LocatorFilterEntry> BasicLocatorFilterTest::matchesFor(const QString &searchText)
|
||||
{
|
||||
doBeforeLocatorRun();
|
||||
const QList<ILocatorFilter *> filters = QList<ILocatorFilter *>() << m_filter;
|
||||
m_filter->prepareSearch(searchText);
|
||||
QFuture<LocatorFilterEntry> locatorSearch = Utils::runAsync(&Internal::runSearch, filters,
|
||||
searchText);
|
||||
QFuture<LocatorFilterEntry> locatorSearch = Utils::runAsync(
|
||||
&Internal::runSearch, QList<ILocatorFilter *>({m_filter}), searchText);
|
||||
locatorSearch.waitForFinished();
|
||||
doAfterLocatorRun();
|
||||
return locatorSearch.results();
|
||||
|
@@ -195,7 +195,7 @@ void TestCase::closeEditorAtEndOfTestCase(Core::IEditor *editor)
|
||||
|
||||
bool TestCase::closeEditorWithoutGarbageCollectorInvocation(Core::IEditor *editor)
|
||||
{
|
||||
return closeEditorsWithoutGarbageCollectorInvocation(QList<Core::IEditor *>() << editor);
|
||||
return closeEditorsWithoutGarbageCollectorInvocation({editor});
|
||||
}
|
||||
|
||||
CPlusPlus::Document::Ptr TestCase::waitForFileInGlobalSnapshot(const QString &filePath,
|
||||
|
@@ -148,7 +148,7 @@ DisassemblerAgentPrivate::DisassemblerAgentPrivate(DebuggerEngine *engine)
|
||||
|
||||
DisassemblerAgentPrivate::~DisassemblerAgentPrivate()
|
||||
{
|
||||
EditorManager::closeDocuments(QList<IDocument *>() << document);
|
||||
EditorManager::closeDocuments({document});
|
||||
document = nullptr;
|
||||
qDeleteAll(breakpointMarks);
|
||||
}
|
||||
|
@@ -96,7 +96,7 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
wizard->setDescription(tr("Creates a Qt Designer form along with a matching class (C++ header and source file) "
|
||||
"for implementation purposes. You can add the form and class to an existing Qt Widget Project."));
|
||||
|
||||
return QList<IWizardFactory *>() << wizard;
|
||||
return {wizard};
|
||||
});
|
||||
#endif
|
||||
|
||||
|
@@ -395,13 +395,10 @@ void HelpWidget::addSideBar()
|
||||
shortcutMap.insert(Constants::HELP_OPENPAGES, cmd);
|
||||
}
|
||||
|
||||
QList<Core::SideBarItem *> itemList;
|
||||
itemList << contentItem << indexItem << bookmarkItem << searchItem;
|
||||
QList<Core::SideBarItem *> itemList = {contentItem, indexItem, bookmarkItem, searchItem};
|
||||
if (openPagesItem)
|
||||
itemList << openPagesItem;
|
||||
m_sideBar = new Core::SideBar(itemList,
|
||||
QList<Core::SideBarItem *>() << contentItem
|
||||
<< (openPagesItem ? openPagesItem : indexItem));
|
||||
m_sideBar = new Core::SideBar(itemList, {contentItem, (openPagesItem ? openPagesItem : indexItem)});
|
||||
m_sideBar->setShortcutMap(shortcutMap);
|
||||
m_sideBar->setCloseWhenEmpty(true);
|
||||
m_sideBarSplitter->insertWidget(0, m_sideBar);
|
||||
|
@@ -281,5 +281,5 @@ QList<QToolButton *> SearchSideBarItem::createToolBarWidgets()
|
||||
reindexButton->setToolTip(tr("Regenerate Index"));
|
||||
connect(reindexButton, &QAbstractButton::clicked,
|
||||
static_cast<SearchWidget *>(widget()), &SearchWidget::reindexDocumentation);
|
||||
return QList<QToolButton *>() << reindexButton;
|
||||
return {reindexButton};
|
||||
}
|
||||
|
@@ -688,7 +688,7 @@ void AppOutputPane::tabChanged(int i)
|
||||
|
||||
void AppOutputPane::contextMenuRequested(const QPoint &pos, int index)
|
||||
{
|
||||
QList<QAction *> actions = QList<QAction *>() << m_closeCurrentTabAction << m_closeAllTabsAction << m_closeOtherTabsAction;
|
||||
const QList<QAction *> actions = {m_closeCurrentTabAction, m_closeAllTabsAction, m_closeOtherTabsAction};
|
||||
QAction *action = QMenu::exec(actions, m_tabWidget->mapToGlobal(pos), nullptr, m_tabWidget);
|
||||
const int currentIdx = index != -1 ? index : currentIndex();
|
||||
if (action == m_closeCurrentTabAction) {
|
||||
|
@@ -115,7 +115,7 @@ void BuildConfiguration::initialize(const BuildInfo *info)
|
||||
|
||||
QList<NamedWidget *> BuildConfiguration::createSubConfigWidgets()
|
||||
{
|
||||
return QList<NamedWidget *>() << new BuildEnvironmentWidget(this);
|
||||
return {new BuildEnvironmentWidget(this)};
|
||||
}
|
||||
|
||||
QList<Core::Id> BuildConfiguration::knownStepLists() const
|
||||
|
@@ -553,7 +553,7 @@ bool BuildManager::buildLists(QList<BuildStepList *> bsls, const QStringList &pr
|
||||
|
||||
void BuildManager::appendStep(BuildStep *step, const QString &name)
|
||||
{
|
||||
bool success = buildQueueAppend(QList<BuildStep *>() << step, QStringList() << name);
|
||||
bool success = buildQueueAppend({step}, {name});
|
||||
if (!success) {
|
||||
d->m_outputWindow->popup(IOutputPane::NoModeSwitch);
|
||||
return;
|
||||
|
@@ -86,7 +86,7 @@ Utils::FileIterator *CurrentProjectFind::files(const QStringList &nameFilters,
|
||||
QString projectFile = additionalParameters.toString();
|
||||
for (Project *project : SessionManager::projects()) {
|
||||
if (project->document() && projectFile == project->projectFilePath().toString())
|
||||
return filesForProjects(nameFilters, exclusionFilters, QList<Project *>() << project);
|
||||
return filesForProjects(nameFilters, exclusionFilters, {project});
|
||||
}
|
||||
return new Utils::FileListIterator(QStringList(), QList<QTextCodec *>());
|
||||
}
|
||||
|
@@ -172,7 +172,7 @@ QList<QWizardPage *> ProjectFileWizardExtension::extensionPages(const IWizardFac
|
||||
// Init context with page and projects
|
||||
m_context->page = new ProjectWizardPage;
|
||||
m_context->wizard = wizard;
|
||||
return QList<QWizardPage *>() << m_context->page;
|
||||
return {m_context->page};
|
||||
}
|
||||
|
||||
bool ProjectFileWizardExtension::processFiles(
|
||||
|
@@ -83,7 +83,7 @@ void Search::rowEntered(const QModelIndex &index)
|
||||
if (m_scene) {
|
||||
ScxmlTag *tag = m_model->tag(m_proxyModel->mapToSource(index));
|
||||
if (tag)
|
||||
m_scene->highlightItems(QVector<ScxmlTag*>() << tag);
|
||||
m_scene->highlightItems({tag});
|
||||
else
|
||||
m_scene->unhighlightAll();
|
||||
}
|
||||
|
@@ -202,7 +202,7 @@ void Structure::rowEntered(const QModelIndex &index)
|
||||
QModelIndex ind = m_proxyModel->mapToSource(index);
|
||||
auto tag = static_cast<ScxmlTag*>(ind.internalPointer());
|
||||
if (tag)
|
||||
m_scene->highlightItems(QVector<ScxmlTag*>() << tag);
|
||||
m_scene->highlightItems({tag});
|
||||
else
|
||||
m_scene->unhighlightAll();
|
||||
}
|
||||
|
@@ -870,7 +870,7 @@ void GraphicsScene::highlightWarningItem(const ScxmlEditor::OutputPane::Warning
|
||||
ScxmlTag *tag = tagByWarning(w);
|
||||
|
||||
if (tag)
|
||||
highlightItems(QVector<ScxmlTag*>() << tag);
|
||||
highlightItems({tag});
|
||||
else
|
||||
unhighlightAll();
|
||||
}
|
||||
|
@@ -66,7 +66,7 @@ Utils::FileIterator *FindInCurrentFile::files(const QStringList &nameFilters,
|
||||
QTextCodec *codec = openEditorEncodings.value(fileName);
|
||||
if (!codec)
|
||||
codec = Core::EditorManager::defaultTextCodec();
|
||||
return new Utils::FileListIterator(QStringList(fileName), QList<QTextCodec *>() << codec);
|
||||
return new Utils::FileListIterator({fileName}, {codec});
|
||||
}
|
||||
|
||||
QVariant FindInCurrentFile::additionalParameters() const
|
||||
|
@@ -79,7 +79,7 @@ FileIterator *FindInFiles::files(const QStringList &nameFilters,
|
||||
const QStringList &exclusionFilters,
|
||||
const QVariant &additionalParameters) const
|
||||
{
|
||||
return new SubDirFileIterator(QStringList() << additionalParameters.toString(),
|
||||
return new SubDirFileIterator({additionalParameters.toString()},
|
||||
nameFilters,
|
||||
exclusionFilters,
|
||||
EditorManager::defaultTextCodec());
|
||||
|
Reference in New Issue
Block a user